Hi,
If we have a set of customers and we want to get only the DOM instances where the field customer matches one of the customers in the set.
Which filter could be used for that purpose?
Thanks in advance.
Julio Riambau [SLC] [DevOps Advocate] Selected answer as best 30th January 2024
Hi Julio,
This is possible by making use of an ORFilterElement as shown in the example below.
var areaFilter = new ORFilterElement<DomInstance>(domainsLinkedToVsGroup.Select(d => DomInstanceExposers.FieldValues.DomInstanceField(SlcMediaOps.Sections.Area_Info.Domains).Contains(d)).ToArray());
Thomas Ghysbrecht [SLC] [DevOps Enabler] Edited comment 31st January 2024
Some small side notes for this one. Make sure that the amount of OR clauses does not exceed 500. If that would be the case, you’ll have to split up the list and do multiple queries. Also keep in mind that with the code example above, you check if the collection (domainsLinkedToVsGroup in this case) has any items and do not use the filter if that collection is empty. Otherwise, the ORFilterElement will be created with an empty collection which makes it equivalent to a TRUEFilterElement, resulting in all items to be retrieved. If you execute this on a DOM manager that contains a million DOM instances, (and not use paging) this could cause problems. In the SLNetTypes.dll, there is a ‘Tools.RetrieveBigOrFilter’ method that you could use, which safeguards you from both these possible pitfalls.