Question Status

Suggested Answer
Pradeep Itnal asked a question on 24 Jun 2013 12:21 PM

hi guys

I am working on PSAManageInvoice Report, (Projects->InvoiceProposal->PrintPreview), I have created a new Precision design under the report, PSAManageInvoice, for Example "ReportPeriod" how do i open the report with this design???

I checked in standard AX, i get numerous examples, but i am missing some steps here.

In PsaProjAndContractInvoiceController, class i am trying to add my new design, but for some reason, it gives me syntax errors :

this.reportName(ssrsReprtStr(PSAManageInvoice,reportPeriod); does not work???

any help in this regard, or steps to be followed??? is much appreciated.

Reply
Suggested Answer
Brandon Wiese responded on 24 Jun 2013 2:37 PM

Assuming that you are launching the report from an Output menu item, have you specified the report design on that menu item?  If so, try clearing that.  I'm not sure what happens if you specify by code and also on the menu item (which wins?).  I think it depends on where you set it in your code.

Reply
Suggested Answer
Brandon Wiese responded on 24 Jun 2013 5:50 PM

I'm not sure why your approach is not working for you.  I have myself changed the report design in code and never had trouble with it, but admittedly not with that report or any Print management document.

I suspect that the report name is being reset in another place, and that your change is not "sticking" all the way through to printing.  For example, within that PSAProjAndContractInvoiceController class in the method runPrintMgmt() you can see the line of code

 this.parmReportName(fiscalDocument.getReportName());

that changes the report name again right before printing, though this only applies apparently when BrazilParameters::isEnabled().  

I think you should place a breakpoint in Classes\PrintMgmtReportRun\execute() or Classes\SrsReportRunController\runReport() or a similar piece of code later in the print process, to see if your change is being overwritten.

Reply
Pradeep Itnal responded on 24 Jun 2013 12:26 PM

i know, the process to set it up, using the FormSetup and then choose, the new design, and the process behind it, what if i have 5 designs and i wan to them to open, based on certain conditions.

Reply
Brandon Wiese responded on 24 Jun 2013 1:18 PM

You are taking the right approach, but in the code that you posted you are missing an end parenthesis.  Was that a typo or is that the actual source of the syntax error?

Reply
Pradeep Itnal responded on 24 Jun 2013 2:14 PM

hi Brandon thanks for the reply, ya it was a typo. however i have written my code in..

\Classes\PSAProjAndContractInvoiceController\initArgs. instead of standard line of code...

this.parmReportName(PrintMgmtDocType::construct(documentType).getDefaultReportFormat()); <-

i have written below code:"

this.parmReportName(ssrsReportStr(PSAManageInvoice,Report1));

but this does not seem to work, it always takes design "report" instead of report1, i guess its taking report design from the form setup..

do you have any pointers to this???

Reply
Suggested Answer
Brandon Wiese responded on 24 Jun 2013 2:37 PM

Assuming that you are launching the report from an Output menu item, have you specified the report design on that menu item?  If so, try clearing that.  I'm not sure what happens if you specify by code and also on the menu item (which wins?).  I think it depends on where you set it in your code.

Reply
Pradeep Itnal responded on 24 Jun 2013 2:46 PM

the menuitem will be opened at runtime, i mean to say its not directly through menuitem, at the run time code decides which report to open, in this case its PSAManageInvoice. however menuitem points to controller class, not directly to the SSRS report.

Reply
Suggested Answer
Brandon Wiese responded on 24 Jun 2013 5:50 PM

I'm not sure why your approach is not working for you.  I have myself changed the report design in code and never had trouble with it, but admittedly not with that report or any Print management document.

I suspect that the report name is being reset in another place, and that your change is not "sticking" all the way through to printing.  For example, within that PSAProjAndContractInvoiceController class in the method runPrintMgmt() you can see the line of code

 this.parmReportName(fiscalDocument.getReportName());

that changes the report name again right before printing, though this only applies apparently when BrazilParameters::isEnabled().  

I think you should place a breakpoint in Classes\PrintMgmtReportRun\execute() or Classes\SrsReportRunController\runReport() or a similar piece of code later in the print process, to see if your change is being overwritten.

Reply
venkatesh vadlamani responded on 25 Jun 2013 12:31 AM

Hey pradeep, you done is right , All you need to do is clear the syslastvalues once and check. I feel that the formLetterReports currentsettingDetails member value is initialized using syslast values.

Please place your debbuger in the  outputReports method and trace through the execute method. I tried to do this  but i am now 6.1 fpk so there is nor printmanagement setting on the report in this version

Reply
Sivananth Subramaniam responded on 25 Jun 2013 9:49 PM

Please look into PrintMgmtReportFormat table and it has the Report Name with its Design Name to be executed. The default design name for all the reports in the table is Report. The reports present in the table are based on the Print Management Settings. I guess the table has your report (PSAManageInvoice) also.

 

So if you add multiple designs and changing the design name in the Controller class will not solve your problem. Since, the code always picks up the design name from the above table and executes the design.

1. You can add your customized design name in the above table instead of default one.

2. Try to add your code to execute the customized design in the class PrintMgmtDocType\getDefaultReportFormat method.

I hope this will solve your problem.

Reply
Zahir Hussan responded on 25 Mar 2014 11:01 PM

Hi All,      

     In my case, I have two different report designs. Based on purchase type i need to locate the different report designs. For example, if my purchase type is "purchase order" i need to show the report design 1 and if my purchase type is "returned order", i need to show the report design 2 from the same copy/original product receipt button.

How to do that? any idea? Is that can be done through SSRS controller classes?

Regards,

Zahir

Reply
venkatesh vadlamani responded on 26 Mar 2014 9:52 PM

Instead of getting the report name from formLetterReport.getCurrentPrintSetting().parmReportFormatName();

over ride the report name when the confirmation journal is of type return with your new design name.

This is to be done in the controller class outputReport method is the controller can extend the class SrsPrintMgmtFormLetterController in some fashion.

Regards

Venkatesh

Reply
Zahir Hussan responded on 27 Mar 2014 4:56 AM

Hi Venkatesh,

Thanks for your reply !!

You mean to say that i need to write my logic at 'Output' method of controller class to execute my different designs at run time???

Regards,

Zahir

Reply
venkatesh vadlamani responded on 27 Mar 2014 9:59 PM

If the report's controller extends SrsPrintMgmtFormLetterController class . Then override the outputReport method,set the report design name and call super.  If the report controller doesn't extend then you might need to write code (override) in outputreports or runPrintMgmt method to set the reportname using  the PrintMgmtPrintSettingDetail class method parmReportFormatName after getting the default formats from print management setting 

Reply
Pradeep Prakash responded on 20 Jun 2014 12:19 AM

Hi Pradeep,

I am the facing the exact issue on PSAProjInvoice report. Can you please let me know the fix for the issue.

Reply
thcrnk responded on 11 Jul 2014 4:41 AM

I did override outputReport method in controller class:

{

    this.parmReportName(ssrsReportStr(ReportName, MyDesign));

    super();

}

and changed the record in PrintMgmtReportFormat  Table to "ReportName.MyDesign" and now its printing my design from everywhere.

Thank You!

Reply