We are trying to filter a List Library control, but we want to negate the filtering of the original view (or add an "Or" rather than "And" to the caml query used).
We have a large list that has more than 5000 items, but we also need to use grouping... so we can't use the normal technique of not filtering at all and then filtering by an indexed column.
So what we tried to do is filter the view in the list by an indexed column that is the lookup column for the item the form is for. But when we try to update the filter, using the code:
fd.control('MCSItems').filter = <FieldRef Name="MCSItem" LookupId="TRUE"/>' + fd.itemId + ';
It returns 0 results as it seem to be adding this filter to the filter that is on the view, rather than replacing the filter. Looking at the network tab, the caml query is that used after my code is run is:
<Query><Where><And><Eq><FieldRef Name=\"MCSItem\"/><Value Type=\"Text\">0</Value></Eq><Eq><FieldRef Name=\"MCSItem\" LookupId=\"TRUE\"/><Value>1457</Value></Eq></And></Where></Query>
Is there any way that we can replace the filter rather than adding to it?
If we could fully replace the filter completely that would be great.
Thanking you in advance!
Why not create a separate view without any filtering specifically for the List or Library?
because I need to have grouping, I can't have grouping without some filtering as there are more than 5000 items in the list. If you try to have grouping with more than 5000 items, it fails due to the threshold limit.
Unfortunately, List View filtering cannot be just disabled. I am not sure why you don't just create a List View specifically for List or Library, which you won't use anywhere else, where you can include grouping, but all the filters will be applied with List or Library CAML filter.
It should function essentially the same, but you'll have only List or Library filters in this case.
If you have a list that has more than 5000 items, you can't enable grouping if you have no filtering.
Please try it and you will see, you just get an error, and then the list library control doesn't work.
We have tried this.
We just need to be able to override the filtering, not disable it, or be able to update the whole CAML query as I can write it manually myself.
Unfortunately, then it's not possible right now, though we can offer paid support to add a new property to List or Library control, which would allow to overwrite existing filter. It will require a little bit of development time to implement, and if you're interested - contact us at [email protected], where we can estimate it.