Hi,
Please refer to my earlier post to view the report SSRSPrecisionDesign related classes, tables and menu Item.
Custom Tables: SampleTable and SampleTrans
Note: Please generate the labels accordingly, for demo purpose static text was left as-is.
In this post, we will see how to control the visibility of report columns based on the selected parameters. For demo purpose, let us add a new boolean report pararmeter showHeaderDesc such that if its not enabled hide the description column from SampleTable(i.e second column in the report)
Step 1: In the contract class SSRSReportContract, added a new parm method by name parmShowHeaderDesc.
showHeaderDesc is a boolean variable
// <summary>
/// Gets or sets the value of the datacontract parameter ShowHeaderDesc.
/// </summary>
/// <param name="_showHeaderDesc">
/// The new value of the datacontract parameter ShowHeaderDesc; optional.
/// </param>
/// <returns>
/// The current value of datacontract parameter ShowHeaderDesc
/// </returns>
[
DataMemberAttribute('ShowHeaderDesc'),
SysOperationLabelAttribute(literalstr("Show header description")),
SysOperationGroupMemberAttribute('Criteria'),
SysOperationDisplayOrderAttribute('4')
]
public boolean parmShowHeaderDesc(boolean _showHeaderDesc = showHeaderDesc)
{
showHeaderDesc = _showHeaderDesc;
return showHeaderDesc;
}
Step 2: Built the solution and refreshed the dataset "SSRSReportDP" under the DataSets node of SSRSPrecisionDesignReport for the new parameter to appear. Deployed the report.
Step 3: In the Visual Studio solution, select the required report and click on "edit using designer" option to open the report designer window.
Expression: =iif(Parameters!SSRSReportDP_ShowHeaderDesc.Value,false,true)
Step 5: Built the solution, deployed the report and generated the report by setting the value of parameter showHeaderDesc to Yes and to No to see the difference.
Report Output - with showHeaderDesc set to No
Report Output - with showHeaderDesc set to Yes
Regards,
Chaitanya Golla
*This post is locked for comments