Monday, February 12, 2018

Parameter screen in ssrs reports













Today i discuss the ssrs report paramter it is easy to deploy


Common Uses for Parameters

Here are some of the most common ways to use parameters.
Control Paginated and Mobile Report Data
  • Filter paginated report data at the data source by writing dataset queries that contain variables.
  • Filter data from a shared dataset. When you add a shared dataset to a paginated report, you cannot change the query. In the report, you can add a dataset filter that includes a reference to a report parameter that you create.
  • Filter data from a shared dataset in a SQL Server mobile report. See Create mobile reports with SQL Server Mobile Report Publisher for more information.
  • Enable users to specify values to customize the data in a paginated report. For example, provide two parameters for the start date and end date for sales data.
    Connect Related Reports
  • Use parameters to relate main reports to drillthrough reports, to subreports, and to linked reports. When you design a set of reports, you can design each report to answer certain questions. Each report can provide a different view or a different level of detail for related information. To provide a set of interrelated reports, create parameters for the related data on target reports.
  • Customize sets of parameters for multiple users. Create two linked reports based on a sales report on the report server. One linked report uses predefined parameter values for sales persons and the second linked report uses predefined parameter values for sales managers. Both reports use the same report definition.
    Vary Report Presentation
  • Send commands to a report server through a URL request, to customize the rendering of a report. For more information, see URL Access (SSRS) and Pass a Report Parameter Within a URL.
  • Enable users to specify values to help customize the appearance of a report. For example, provide a Boolean parameter to indicate whether to expand or collapse all nested row groups in a table.
  • Enable users to customize report data and appearance by including parameters in an expression.

SSRS : Enable/ Disable contract class Control Based on other contract parameter control

In this blog we will see how to enable / disable contract class parameter control based on the modification of other contract class parameter. This all is going to be happened in UI Builder class
So here we go
1.       First write the Method which is responsible to perform actual functions like enabling and disabling control
In this blog I will be using Enum Control and based on its modification disabling lookup controls

Where in below image Report Type is Enum Control and WindMast and Sensor are the lookup controls
Enable/ Disable Method should be written in UI Builder class will be like
private boolean EnableControls(FormComboBoxControl _control)
{
   
   
    if(_control.valueStr() == enum2str(TK_TurbineSummary::Production))
    {
    dWindMast.enabled(false);
    dSensor.enabled(false);
    }
    else
    {
       dWindMast.enabled(true);
    dSensor.enabled(true);
    }
    return true;
}
In above piece of code I have disable the lookup controls On “Production” Report Type and make them enable on Wind Speed Report Type
Where dWindMast and dSensors are the dialog field define in Build method of UI Class like Below
Now In Post Build Method of UI Class we need to register our above created method “EnableControls”  Like below
public void postBuild()
{
 dReportType = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(TK_TurbineSummaryContract, parmReportType));
            dReportType.registerOverrideMethod(methodStr(FormComboBoxControl, modified), methodStr(TK_TurbineSummaryUI, EnableControls), this);
            dShowProduction = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(TK_TurbineSummaryContract, parmShowProduction));
}
When we Run Report and change the Report type Drop down value Result will be as below
Disable Controls : 
Enabling Control on drop down selection changed