This article provides two scripting examples of how to filter to find items based on whether or not they have Description content.

Filter and Variable Example 

In this example, the goal is to return items that have description content. In order to do this, we use the <DescriptionIsEmpty/> filter together with <NOT> to negate the filter. After defining the filter, we can iterate over a list of items using ForEach and call the filter using an <If filter=""> tag.   

<Filter name="IsDescriptionNotEmpty">

<!--Variable defined as following-->
<Variable name="HIwithDescription" select="/ITSR" as="[Item]"/>


<ForEach select="$HIwithDescription">
    <If filter="IsDescriptionNotEmpty">
        <!—do something… -->

Filter and Function Example

Another way to do the filtering is to use a function that calls a filter, and then use the function in any path query.  

    <Filter name="F1">

    <Function name="IsEmptyDesc" as="Boolean">
        <Parameter name="para1" as="[Item]"/>
            <When filter="F1">
                <Value select="false"/>
                <Value select="true"/>

    <!--Check if the current item has an empty Description-->
    <Text>#{? IsEmptyDesc(.)}</Text>
    <!--Return the item with empty  Description-->
    <Text>#{? /ITSR[IsEmptyDesc(.)]}</Text>