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

[Solved] FilterExpression string pattern

9 Answers 437 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Katya
Top achievements
Rank 1
Katya asked on 06 Oct 2009, 04:32 PM
Hi,

I have to parse FilterExpression string (grd.MasterTableView.FilterExpression), and I look for some pattern for this string.
I get Filter Expressions  like:
(iif(firstname == null, "", firstname).ToString().Contains("a"))



Now I use this pattern (Regex):
 .*\\(.*,.*,(.*)\\)\\..*\\.(.*)\\(\"(.*)\"\\)\\)

so I get column name, current filter function and input text.
But I'm not sure it'll be correct in all cases.

Please, help me to find valid pattern for FilterExpression.
Thanx

9 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 09 Oct 2009, 08:35 AM
Hi Katya,

Another option in this case would be to simply iterate through the columns, and get the currentFilterFunction and CurrentFilterValue. Additional information on the syntax is available in the following article:

http://www.telerik.com/help/aspnet-ajax/grdapplyingdefaultfilteroninitialload.html

I hope this helps.

Regards,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Katya
Top achievements
Rank 1
answered on 09 Oct 2009, 09:15 AM
Thank you for reply,

I have the following situation:
1. There is any radGrid
2. User input filters criteria and then select any grid item
3. After this, user redirect to another page
4. At new page the rad grid must looks like it was before redirect, with all settings

Cause i have redirect, I have to save filter expression in the Session.
I wouldn't like to save more settings in session.

So, when the page prerender, I try to parse this string. But I don't understand on which principle  it's constructed...

Thank you in advance

0
Vlad
Telerik team
answered on 09 Oct 2009, 02:14 PM
Hi Katya,

Why not save/restore directly as string?

All the best,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Katya
Top achievements
Rank 1
answered on 09 Oct 2009, 03:48 PM
Hi Vlad,

yes, I save and restore filterExpression directly as string. So, I get filtered items in my grid.
But I don't get text in input field and don't get filterFunction for each column.

The following link describe the similar situation: http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-gridsettingspersister-filter-states.aspx

 I don't have an answer for my general question: how is the filter expression constructed?
Thanx
0
Sebastian
Telerik team
answered on 12 Oct 2009, 09:19 AM
Hello Katya,

The FilterExpression of the grid follows the concepts of the DataView.Filter property structure as explained in this topic from the product documentation.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Katya
Top achievements
Rank 1
answered on 13 Oct 2009, 01:26 PM
Hi,

i still have no solution for my problem.

  • Reading  the topic, I understood that it's possible to determine "what filter function the grid is currently employing"
  • I need to save all filter settings for each column and restore its after redirect
  • But I don't want to store this info for each column in Session
  • I want to save only one string - filterExpression string, which consist all needed info

Is there any way to get all needed info from filter expression string?
Thanx
0
Accepted
Sebastian
Telerik team
answered on 13 Oct 2009, 02:39 PM
Hello Katya,

I think that this help topic will help you achieve your goal:
http://www.telerik.com/help/aspnet-ajax/grdsavingsettingsonperuserbasis.html

Refer to the part which saves and restores the filter expression value.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Katya
Top achievements
Rank 1
answered on 13 Oct 2009, 03:17 PM
Thank you for reply,

I already read this solution, but it required to save array of settings - Pair[] columnFilter at least. But I want save only one string.

Please, refer to this (already posted), it's the similar problem:
http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-gridsettingspersister-filter-states.aspx

Please, answer, how the expression is constructed? Can I be sure that all strings I get will be like this:
(iif(firstname == null, "", firstname).ToString().ToUpper().Contains("a".ToUpper()))

Where is the column name position in this string? I see, that now it's the 3d parameter in breaks, but is it always true? What is "iif"? Is it any regular expression for this?

Thanx

0
Katya
Top achievements
Rank 1
answered on 13 Oct 2009, 03:55 PM
ok, I'll save array of parameters in the Session)

Thank you in advance!
Tags
Grid
Asked by
Katya
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Katya
Top achievements
Rank 1
Vlad
Telerik team
Sebastian
Telerik team
Share this question
or