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

Filtering by dynamic list when no selection is made

5 Answers 40 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Al
Top achievements
Rank 1
Iron
Iron
Veteran
Al asked on 12 Aug 2016, 02:56 PM

Hi,
I have a report that shows eg. Company and department names, I have built a filter by both of these to say

Company in Company parameter
and
Department in Department parameter

Where the Company and Department parameters are multi-value and are built from a datasource. Everything works just fine...as long as at least one company and department value are selected in the filter boxes ie. it is always filtering on these fields.

How do I get the report to display everything when nothing is selected in the filter boxes?

5 Answers, 1 is accepted

Sort by
0
Katia
Telerik team
answered on 15 Aug 2016, 12:32 PM
Hi Al,

Set the default value for both parameters so if no value is set by the user the filters will be applied based on the parameters default values.

To set multiple values(all values) as the default ones, set the parameters Value property to an IEnumerable instance  - check Specifying Default Values for a MultiValue Parameter for more detailed information.


Regards,
Katia
Telerik by Progress
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 Feedback Portal and vote to affect the priority of the items
0
Al
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 15 Aug 2016, 01:21 PM

Thanks Katia,

I use the html viewer with a custom resolver to load trdp reports dynamically - how would I use that code in that scenario?

I mean I know how to set parameters default values but how would I get the argument "Fields.MyField" to pass to AllValues(object[] values).

0
Katia
Telerik team
answered on 15 Aug 2016, 02:28 PM
Hi Al,

In case, you need to set report parameters in custom resolver you can work directly with the report instance's ReportParameters collection, for example:
Telerik.Reporting.Report report = new Report1();
report.ReportParameters["Parameter1"].Value = "= AllValues(Fields.MyField)";

Note, that TRDP report needs to be unpackaged first - Unpackaging.


Regards,
Katia
Telerik by Progress
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 Feedback Portal and vote to affect the priority of the items
0
Al
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 15 Aug 2016, 02:50 PM

Thanks Katia,

I'll give that a bash but am pretty sure it will not work as per my post here:

Setting Parameters at Runtime

 

0
Al
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 16 Aug 2016, 10:26 AM

Just some feedback - I have no clue what's going on here but here is my code that does indeed seem to set the default value for multi-value parameters to all available options in a custom resolver:

Thanks Katia.

 

ReportConnectionStringManager csm = new ReportConnectionStringManager(providerConnStr);
 
var appPath = HttpContext.Current.Server.MapPath("~/");
var reportsPath = Path.Combine(appPath, "Reports");
var uri = Path.Combine(reportsPath, report);
 
var sourceReportSource = new UriReportSource()  { Uri = uri };
 
reportInstance = csm.UpdateReportSource(sourceReportSource);
 
//Set parameters
foreach (var reportParm in (reportInstance as InstanceReportSource).ReportDocument.ReportParameters)
{
    if (reportParm.Name.ToLower() == "Department".ToLower())
    {
        reportParm.Value = "= AllValues(Fields.Department)";
    }
}

Tags
Report Designer (standalone)
Asked by
Al
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Katia
Telerik team
Al
Top achievements
Rank 1
Iron
Iron
Veteran
Share this question
or