Many Questions...

2 posts, 0 answers
  1. Mark
    Mark avatar
    10 posts
    Member since:
    Jul 2013

    Posted 03 Jul 2013 Link to this post

    I am looking to use the filter control as a tool to let my clients easily generate there own SQL where conditions.  Please realize though that I am using this control alone and do not have/want it tied to a grid or any other control. However I have some conditions that at the moment doesn't seem to work to well with the control.  

    1) I already store in a SQL table all the Fields and Operators a client can select upon.  However the radFilter does not appear to let you define the operators for a specific field on the server side.  So for example I would be adding all my fields on PageLoad or PreInit and maybe I don't want a specific field like "Last Name" to have "IsNull" as a filter option but another field may allow it.
    * Doing this only in the client side like all suggestions seem to direct you is really a hack and leads to unclean code especially when your not blanket-ally removing an operator across all fields.

    2) I would like to make my own field but am wondering if the filter control can handle it.  Say for example someone wanted to query for "Transaction Amount" > 100 and "Transaction Date" between 1/1/2012 and 3/3/2012.  To handle this properly you would have to make a unique operator(s) that would let you set the fields shown.  You may also want to do something like "Transaction Amount" between 100 and 1000 and "Transaction Date" between 1/1/2012 and 3/3/2012.  Then there would be possibility of 4 values and 2 operator conditions.
    * Please realize that what I am saying is different then 2 different filter items.  Because I am specifically saying i want to find people with a transaction amount greater then 100 between the specific dates.  If you used what the Sqlprovider gives you actually end up with people who have some transaction > 100 unrelated to the provided supplied date range.  I realize that this requires parsing on my part and wouldn't rely on the SqlProvider for anything.

    3) There appears to be no built in method to get a simple representation of the filters other then radFilter.RootGroup.Expressions but you have to parse all the fields out yourself?
    * Has telerik given any thought to a XmlProvider so that you can get a representation of the filter fields, operators, and values as XML?  This would allow others to take that XML and interpret it how they choose.

    4) Similar to number 3 the Save/Load functionality should support an xml string versus base64 encoded string.  This would allow you to interpret the xml how you choose and possibly review created selects directly in sql.
  2. Antonio Stoilkov
    Antonio Stoilkov avatar
    530 posts

    Posted 08 Jul 2013 Link to this post

    Hello Mark,

    Regarding your first question: You are correct in your observation that the filter options could be limited only on the client. However, the described approach is required because RadFilter uses one RadMenu for all filter options and does not have distinction for individual filter items in order to limit the options individually.

    Regarding your second question: You could achieve your scenario by creating your own custom field editor in which you could place any control you want and then use the query provider ExpressionEvaluated delegate which is available in our latest official release and could help you in altering a query provider result string. You could take a look at the demos and help articles below which describe how to implement the things described above.

    Regarding your third question: In the latest release we have implemented couple of new methods for working with filter expression items that are documented in the article below. The methods involved are - 

    Regarding the XML representation: I can ensure you I have contacted our dev team and notified them for your suggestions. Note that decisions for implementing a particular functionality is based on the customer demand rates and the control needs.

    Antonio Stoilkov
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top