How to change SSRS Report Design based on Dialog value

Scenario - 
  • In my case, I have a dialog field called 'Language' which is a deciding factor to open up a particular SSRS report design.
Problem - 
  • Run different report designs based on user input.
Solution - 
  • Add a parm method called parmLanguageId() in the Report Contract class.
  • Create a method called getReportName() to return the Report name in Report Controller class.
  • Override the preRunModifyContract() method of the Report Controller class.
[
   DataMemberAttribute('languageId'),
   SysOperationLabelAttribute('Language'),
   SysOperationHelpTextAttribute('Set language'),
   SysOperationDisplayOrderAttribute('3')
]
public LanguageId parmLanguageId(LanguageId _languageId = languageId)
{
   languageId = _languageId;
   return languageId;
}
private str getReportName(MyContractClass _contract)
{
    str reportName;
    LanguageId  languageId = _contract.parmLanguageId();  
    if (languageId && languageId == 'ru')
    {
        this.parmReportContract().parmRdlContract().parmLanguageId('ru');
        reportName = ssrsReportStr(MyReport, Design_RU);
    }
    else
    {
reportName = ssrsReportStr(MyReport, Design_UK);
    }
    return reportName;
} 
protected void preRunModifyContract()
{
    MyReportContract contract = this.parmReportContract().parmRdpContract() as MyReportContract;
    this.parmReportContract().parmReportName(this.getReportName(contract));
    super();
}

Comments

Popular posts from this blog

How to check if the Item is Batch / Serial Controlled through X++ Code

How to move temporary form data to RDP Class of SSRS Report in Dynamics AX