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

Setting Filter values Programatically.

1 Answer 105 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sandeep Pulkundwar
Top achievements
Rank 1
Sandeep Pulkundwar asked on 29 Jul 2009, 07:16 AM
I am trying to create Filters at Runtime as i have some Custom Logic that needs to be developed for Our Operations Team to work.

Below ic code that i am using.
Report report = (Report)this.ReportViewer1.Report; 
        if (!Page.IsPostBack) 
        { 
            PopulateStatus(); 
        } 
 
        if (!RadDatePicker1.SelectedDate.HasValue) 
        { 
            RadDatePicker1.SelectedDate = DateTime.Today; 
        } 
         
        report.Filters.Add(new Telerik.Reporting.Data.Filter("StartTime", Telerik.Reporting.Data.FilterOperator.GreaterOrEqual, RadDatePicker1.SelectedDate.ToString())); 
         
        string temp = ComboWithCheckBoxes1.GetCommaSeparatedValues(); 
        if (!string.IsNullOrEmpty(temp)) 
        { 
            report.Filters.Add(new Telerik.Reporting.Data.Filter("BookingItemStatusId", Telerik.Reporting.Data.FilterOperator.In, temp)); 
        } 

In above Code filter at Line 12 seems to work Perfectly but the Filter set at Line 17 doesnot display any results. No results are displayed Matching Criteria,

The Filter Explressions that  i can see are

For Lin 12
{StartTime >= 29/07/2009 00:00:00} 
For Line 17
{BookingItemStatusId In 9435038e-92d3-4b89-bcef-ce37eb787936,5f6065b2-d392-4b0e-a738-f16f71f1547e,a1a8e6ea-a275-4f76-b28c-96cfe34bea11,e8fac681-1852-4b8a-adeb-328e940115ac,b5830192-a2e4-4e98-ac46-483bbcdb5a05,369b843b-48e6-479c-841e-1b2c42039be0}

Just to Let you know i have selected all Status Values. If  dont select any value results are displayed but when i select 

1 Answer, 1 is accepted

Sort by
0
Janus Pedersen
Top achievements
Rank 2
answered on 30 Jul 2009, 10:50 PM
Hi
I just use this code
        /// <summary>  
        /// Opretter en gruppering af en bestemt kolonne  
        /// </summary>  
        /// <param name="gruppering">Navn på den kolonne der skal grupperes efter (uden ligmed. Må ikke indeholde ligmed)</param>  
        /// <param name="tekst">Hvis der skal stå en tekst før kolonne indholdet. Valgfri.</param>  
        private void opretGruppe(string gruppering, string tekst)  
        {  
            if (textBox8.Value.Length > 1)  // Er det den første tekst der grupperes på?  
            {   // Hvis nej så sættes der et " - "  
                textBox8.Value = textBox8.Value + " - " + tekst + "{=" + gruppering + "}";  
            }  
            else 
            {   // Hvis ja sættes tekstn blot ind sammen med grupperingen  
                textBox8.Value = textBox8.Value + tekst + "{=" + gruppering + "}";  
            }  
 
            group3.Grouping.Add("=" + gruppering);  // Opretter selve grupperingen  
        }  
 
I just have made textBox8 as a TextBox to display Info when a groupe is made. Ups this is for gruping.

For filtering I use Dynamic LinQ but you can use Filters.Add(new Filter()); as well.

Janus S. Andersen
Denmark
Tags
General Discussions
Asked by
Sandeep Pulkundwar
Top achievements
Rank 1
Answers by
Janus Pedersen
Top achievements
Rank 2
Share this question
or