Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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