0

I have a custom list that has a text filter connected to allow the user to filter one of the list columns. I now need to add a second XOR text filter to allow the user to filter on a different column in the list. The CAML for the query is:

<Query>
<OrderBy>
    <FieldRef Name="Feeder"/>
    <FieldRef Name="Transformer"/>
</OrderBy>
<Where>
    <Or>
        <Contains>
            <FieldRef Name="Feeder"/>
            <Value Type="Text">{FilterFeeder}</Value>
        </Contains>
        <Contains>
            <FieldRef Name="Transformer"/>
            <Value Type="Text">{FilterTransformer}</Value>
        </Contains>
    </Or>
</Where>
</Query>

This is kind of working but even when one filter is cleared, the filtered list still contains the rows defined by that filter, as well as any rows defined by the other filter.

How do I clear the rows retrieved by the first filter when applying the second one?

1 Answer 1

0

I believe that when the one variable has no value, the CAML is still passing 'OR field = ""' which is returning results. If you set a default value for the first variable that would return no results, you might be able to exclude the values returned from that filter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.