Answered Data View Web Part: Filter based on Approval Status

  • mercoledì 2 maggio 2012 19:01
     
     

    I want to filter my data view web part to display only the "Approved" items.

    However the "Approval Status" field does not appear in the field name list?

    I don't know what is causing the issue. Can someone please share a solution?

    Thank you.

Tutte le risposte

  • giovedì 3 maggio 2012 03:55
     
     Con risposta Contiene codice

    Hi,

    The internal column name for Approval Status is @_ModerationStatus. So use that field to filter.

    If you cant see that column, please refresh the data source in SPD and then select the Add Columns and check can you see the Approval Status column.

    If you still cant see then you can add it manual to the DVWP.

    To do that add the below field to the DataFields property.

    @_ModerationStatus,Approval Status;
    

    And then add the below query section to your WHERE clause inside the datasource SelectCommand

        <Where>
            <Eq>
              <FieldRef Name="_ModerationStatus"/>
              <Value Type="ModStat">Approved</Value>
            </Eq>
        </Where>

    Note:Remove the line breaks in the above where clause and add them appropriately.