Using an IF function in an XPath Constraint

0
Hello, I have a list view that uses an XPath contsraint to show it's values.  The list view is wrapped in a data view with a non-persistable entity as it's data source.  I use the non-persistable entity to filter the list view based on what the user fills out in a pop-up.  I want them to be able to apply multiple filters at the same time.   I can achieve this by using "AND" functions in the XPath constraint.  However, I can't get it to properly allow for list view items that have null values in one or more of the filterable fields.   So this is what I would like to put in the XPath constraint: IF $filter/Name = empty then don't include in XPath else $listview/Name = $filter/Name and IF $filter/City = empty then don't include in XPath else $listview/City = $filter/City and so on. . . Any ideas?
asked
2 answers
2

[$filter/Name = empty or $filter/Name = $listview/Name][$filter/City = empty or $filter/City = $listviewCity]

answered
0

If someone is struggling with this here are two more exapmles that helped me right now for enumeration and contains():

 

for contains Contains:

[

    (

        $FilterHasName and contains(Name, $Filter/Name)

    )

    or $HasName = false()

]

 

for Enumeration:

[

    (

        $FIlterHasType and RequestType = $Filter/RequestType

    )

    or $HasType = false()

]

 

$HasName is created as a new boolean inside the microflow with this expression:

length(trim($Filter/Name))> 0

 

$HasType is created as a new boolean inside the microflow using this expression:

$Filter/RequestType != empty

 

This will result in retrieving all if Name or Type is empty instead of retrieving nothing.

answered