I'm looking into building an adhoc datasource to provide some more insight into usage of our matrix crosspoints. since every crosspoint being made adds an information event i'm tempting to go through them with the repositoryRegistry however instead of fetching all information events on a wildcard and then filtering them i was wondering if i can already dynamicaly add them to an orfilter
Basically i want to add a bunch of
new ORFilterElement<Info>(
InfoExposers.ParameterName.Contains("search x" ),
InfoExposers.Value.Contains("Value x"),
InfoExposers.ElementID.Equal(elementId),
InfoExposers.SeverityID.Equal(severity)
);
into
var filter = new ANDFilterElement<Info>(
InfoExposers.TimeOfArrival.GreaterThan(start),
InfoExposers.TimeOfArrival.LessThan(end),
Dynamiclistof Filters
);
so i can pass them to the: CreateReadQuery(filter).Execute();
is this possible?

Hi Gerwin,
Was Benjamin's comment sufficient to answer your question, or would you still like more information?

i've hadn't had time to look into it. It might be workable but i have to play around with it

No this does not work since i can have an list of infoexposers raning from 1 to 30 or more. I think that for now i'm stuck to client side processing.
Hi Gerwin,
If I understand your question correctly you want to:
- Filter on TimeOfArrival <= x and TimeOfArrival >= y
- Also filter on some exposers of information events
- The information event filters are constructed at runtime based on a different query/method/...
If this is indeed your question than I believe your answer would be about right, to give you a complete example I believe this should work:
var filters = new List<FilterElement<Info>>
{
InfoExposers.TimeOfArrival.GreaterThan(DateTime.UtcNow),
InfoExposers.TimeOfArrival.LessThan(DateTime.UtcNow),
};
for (var i = 0; i < 10; i++)
{
filters.Add(new ORFilterElement<Info>(
InfoExposers.ParameterName.Contains("..."),
InfoExposers.Value.Contains("..."),
InfoExposers.ElementID.Equal(1),
InfoExposers.SeverityID.Equal(1)
));
}
var filter = new ANDFilterElement<Info>(
filters.ToArray()
);
Please let me know if this answer helps you.

That is exactly what i was looking for 🙂
Hello Gerwin!
I haven't had such a use case myself, but I can confirm that code-wise this will compile as these classes are implemented from the same interface, IFilterElement
Here's a code snippet of some combinations you can try:
var orFilter1 = InfoExposers.AlarmID.Equal(7236128).OR(
InfoExposers.AlarmID.Equal(237473),
InfoExposers.AlarmID.Equal(95738));
var orFilter2 = InfoExposers.SeverityID.Equal(4).OR(
InfoExposers.SeverityID.Equal(0),
InfoExposers.SeverityID.Equal(5));
// Option 1: without inital filter
var filter1 = new ANDFilterElement<Info>(orFilter1, orFilter2);
// Option 2: with inital filter
var filter2 = InfoExposers.AlarmID.Equal(2).AND(orFilter1, orFilter2);
// Option 3: Mixed
var filter3 = new ANDFilterElement<Info>(InfoExposers.Comments.Contains("T").AND(orFilter1), orFilter2);