Reputation: 1247
I am currently working on a program using an where I need to filter an UltraGrid based on a few different conditions.
My problem is that I haven't yet found a way to express one of the conditions in the filter. I want one of the conditions to say "if the value in this row is a member of a certain collection, return true".
So for example, if my group is an array [1, 2, 3, 4, 5], a few example results would be:
value = 1: True
value = 2: True
value = 6: False
value = -1: False
Is anyone aware of a simple way of doing this that I'm overlooking? I'd prefer not to create a custom filter if that's doable. Nothing else on the FilterComparisionOperator page appears to match what I'm looking for.
Upvotes: 1
Views: 1402
Reputation: 1247
Ok, I should have read more carefully for this. It looks like each UltraGridBand contains a ColumnFiltersCollection. So, to get the desired behavior, you can create separate ColumnFilters for each desired condition. In this case, one condition would be defined as:
Dim columnFilter As ColumnFilter
columnFilter.LogicalOperator = FilterLogicalOperator.Or
For Each element In MyCollection
columnFilter.FilterConditions.Add(FilterComparisionOperator.Equals, element)
Next
and then you could do a:
Band.ColumnFilters.Add(columnFilter)
Band.ColumnFilters.Add(otherColumnFilter1)
Band.ColumnFilters.Add(otherColumnFilter2)
Band.ColumnFilters.Add(otherColumnFilter3)
See documentation (specifically Remarks) here. Also this code's probably not 100% correct - haven't tested it yet. Should get the idea across though.
Upvotes: 3