web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

SrsReportRunController Run With Parameters

(0) ShareShare
ReportReport
Posted on by 126

Hi All,

I am sending the srss report in pdf format by the following method. How can i run with parameters?

For example My parameters _BuzWarrantyDirectionType.

Thank you.

public void run()
{
SrsReportRunController ssrsController = new SrsReportRunController();
SRSPrintDestinationSettings printerSettings;
str ReportPath,PdfFile;
SysMailer mail = new SysMailer();
SysemailParameters param=SysemailParameters::find();
BuzWarrantyTable _BuzWarrantyTable;//table
BuzWarrantyDirectionType _BuzWarrantyDirectionType = 0;//field
;
PdfFile = "Guarantee Letter List" +"_"+int2str(dayOfMth(today())) +"_"+ int2str(mthOfYr(today()));
ReportPath = "\\\\Server\\Test\\"+PdfFile+".pdf";

ssrsController.parmReportName(ssrsReportStr(LmkKuveytWarrantyTableNotification, LmkKuveytWarrantyTableNotification));
ssrsController.parmExecutionMode(SysOperationExecutionMode::Synchronous);
ssrsController.parmShowDialog(false);

printerSettings = ssrsController.parmReportContract().parmPrintSettings();
printerSettings.landscape(true);
printerSettings.printMediumType(SRSPrintMediumType::File);
printerSettings.fileFormat(SRSReportFileFormat::PDF);
printerSettings.overwriteFile(true);
printerSettings.fileName(@ReportPath);

ssrsController.runReport();
mail.attachments().add(@ReportPath);
mail.quickSend(param.SMTPUserName,"***@***.***","Subject","Description");
}

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,908 Most Valuable Professional on at

    You didn't tell us which parameters you mean, so I'll assume you mean a data contract.

    If the report uses an RDP class, create a contract, fill it in values and pass it to ssrsController.parmReportContract().parmRdpContract(). Like this:

    SysUserLicenseCountRDPContract rdpContract = new SysUserLicenseCountRDPContract();
    rdpContract.parmReportStateDate(systemDateGet());
    ssrsController.parmReportContract().parmRdpContract(rdpContract);
  • MuratGulerMG Profile Picture
    126 on at

    Martin,

    Is there a parameter other than ParmReportStateDate or parmShowUserList? Can I do my ssrs report for query?

  • Martin Dráb Profile Picture
    237,908 Most Valuable Professional on at

    No, parmReportStateDate() is just a method of one particular contract class (SysUserLicenseCountRDPContract) used by one particular report (SysUserLicenseCountReport). It's just an example. I obviously could give you a specific example for your custom report (LmkKuveytWarrantyTableNotification), because you didn't give us any information about it.

    Does you other question mean that your report is based on a query instead of an RDP class? If so, what parameters do you mean? Don't you actually mean query ranges? It seems you should tell us how your report is implemented...

  • MuratGulerMG Profile Picture
    126 on at

    Yes Martin, i want use my _BuzWarrantyTable._BuzWarrantyDirectionType value for my ssrs report. Can i send report parameter with SrsReportRunController? Or another way?

    Thank you.

  • Martin Dráb Profile Picture
    237,908 Most Valuable Professional on at

    That's done by data contract classes. Don't you have it already? Normally you create a data contract and let AX generate dialog fields from it for you, so when doing it in code, you merely fill the class from code instead of from a dialog and pass it to parmRdpContract(), as demonstrated above.

    If you mean something else, you'll have to explain what it is.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans