Hello,
I'm currently using the Skyline.DataMiner.Core.DataMinerSystem.Automation NuGet package to perform filtering on a table in an automation script. In my code, I've already set up a filter to retrieve rows with the value "4" in parameter 1003:
List<ColumnFilter> filter = new List<ColumnFilter>();
filter.Add(new ColumnFilter { Pid = 1003, Value = "4", ComparisonOperator = ComparisonOperator.Equal });
IEnumerable<object[]> filterTable = element.GetTable(1000).QueryData(filter);
Now, I'm looking to create a filter that retrieves rows with values "4" and "2" and apply it within the same query. Is there a way to indicate that multiple filters should be executed with an OR statement?
Thank you.
Hi,
The ColumnFilter translates in the background to an SLNet filter, similar like is being used when executing a dynamic table query.
In that case, when there are multiple parameters included in the filter:
-When the parameter IDs are the same, then for these they are treated as logical OR (= select where pid X has value A OR pid X has value B)
-When the parameter IDs are different, then these are treated as logical AND (= select where pid X has value A AND pid Y has value B)
In the given example for pid 1003 to retrieve values "2" or "4", this becomes:
List<ColumnFilter> filter = new List<ColumnFilter>
{
new ColumnFilter { Pid = 1003, Value = "2", ComparisonOperator = ComparisonOperator.Equal },
new ColumnFilter { Pid = 1003, Value = "4", ComparisonOperator = ComparisonOperator.Equal },
};
IEnumerable<object[]> filterTable = element.GetTable(1000).QueryData(filter);
Regards,
Alright, exactly what I was looking for. Thanks Laurens!