Skip to main content

Notifications

Controlling visibility of report columns based on selected parameters on SSRS report in D365FO

Hi,

Please refer to my earlier post to view the report SSRSPrecisionDesign related classes, tables and menu Item.

https://community.dynamics.com/365/financeandoperations/b/daxology/posts/creating-a-simple-report-in-d365fo

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. 

Step 4: Select the column "Description", right click select the option "Column Visibility", select the option "Show or hide based on expression" and provide the  expression based on parameter ShowHeaderDesc. Saved the changes on the report.

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 Design

Report Output - with showHeaderDesc set to No

Report Output - with showHeaderDesc set to Yes

Regards,

Chaitanya Golla

Comments

*This post is locked for comments