views:

18

answers:

0

I have been trying to decide what the best way to filter a set of data for a tree view is.

The filters are in the following XML format: using periods instead of carots .Category. .FilterCategory(sometimes) FilterAgainstAttribute, FilterDataToCompare, FilterCategory. .Filter Attributes(FilterAgainstAttribute, FilterDataToCompare, FilterCategory/. ./FilterCategory(sometimes) ./Category.

Filtering two datasets: .SuperCategory. .SubCategory. .SpecificItem. AND .SuperCategory. .SpecificItem.

So I've been thinking about writing special conditions for the following, which are required at times because some of the data in a SpecificItem attribute-"" is coma delimited

condition (when critieria has to be evaluated as indexOf()) condition (when criteria applies to a SuperCat) condition (when multiple filters of same category, include expands) condition (when multiple categories being filtered, include narrows)

How can I write a simple function without multiple cases that meets these special conditions, and does typical standard filtering, loops through the multiple data sets to filter.

I've already written out a bunch of specific cases that make this all possible, but I feel like there should be a much simpler, better, and maybe more correct way to do this.