This is a migrated thread and some comments may be shown as answers.

Using the generated filter text

1 Answer 56 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 14 Nov 2010, 07:05 AM
I'm just getting started with Telerik controls.  My question has to do with the RadDataFilter.  I have a need to build a complex search query that I will then submit to an existing service to get the results I need. 

Since I need to send the resulting query text to a service, I have nothing to bind the Filter control to for the Source.  I want the user to enter the words they are interested in, and the AND, OR, NOT operators to end up with something like this:

(("word1" AND "word2") OR ("word3" AND "word4") AND NOT ("Bad Word"))

Is this possible with the DataFilter?

Thanks,

-Scott

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 15 Nov 2010, 09:26 AM
Hello Scott,

You have two options.

In case you need the string in a specific format, you can easily build it yourself by traversing the FilterDescriptors collection of the control. The logical operator property of this collection is in fact the root node of a tree of filter criteria. The collection consists of filter descriptors -- they can be either simple ones (member-operator-value) or composite ones. The composite ones are filter descriptors that contain other filter descriptors and have a logical operator, i.e. they provide the hierarchy. So you can traverse this tree in the order that you want and build the string.

Out-of-the-box, if you call the ToString method of the FilterDescriptors collection it will return a similar string, but chances are it will not be 100% the format that you need to build. Anyway, try this and see what will come out.

I hope this helps. Let me know if you have problems.

Sincerely yours,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
DataFilter
Asked by
Scott
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or