Menu Close

pass temporary data from Ax 2012 to SSRS

I would like to talk a little bit about the SRSTmpTblMarshaller class.
For those who doesn’t know yet, this class makes it possible to share existing temporary data between an AX object and the SSRS.
There are several ways in which you could use a temporary table with the SRSS, but let’s consider the following scenario:
Your report will be printed through a form button and that form uses a temporary table as DataSource. This data can also be manipulated by the user, so you cannot reprocess this data with the DataProvider class.
Instead of turning the temporary table (InMemory) in a regular table – I’ve saw some people doing that, you can use the SRSTmpTblMarshaller as a way batter alternative:
    1. In your contract class, you need to create an accessor method do keep this recordId from the SrsTmpDataStore or you can simply extend the SrsTmpTblMarshallerContract that already have this.
    2. In your controller class, you need to call the sendTmpTblToDataProvid method using your table buffer as parameter. This will store your table buffer as a container inside the SrsTmpDataStore table and return the recordId: protected void preRunModifyContract()
      SrsTmpTblMarshallerContract contract = this.parmReportContract().parmRdpContract() as SrsTmpTblMarshallerContract;

      // get the Temp table, and marshall it across to SSRS
      new SRSReportRunPermission().assert();
    3. Request permission by using the assert method in the  SRSReportRunPermission class
    4. Set the recordId inside the accessor method that you’ve created.
    5. Then in your data provider class you can unpack your table buffer using the method getTmpTbl from SRSTmpTblMarshaller class using as parameters the recordId from the SrsTmpDataStore table that you kept in your contract:
      private void initBankReconciliationPrintoutTmp()
      SrsTmpTblMarshallerContract contract = this.parmDataContract()as SrsTmpTblMarshallerContract;
      //Temp Table Object that was returned from SRSDataCarrier
      new SRSReportRunPermission().assert();
      bankReconciliationPrintoutTmp = SRSTmpTblMarshaller::getTmpTbl(contract.parmTmpTableDataRecId());
    6. Remove your buffer from the scope using the deleteTmpTblData method.
    7. You can also check the BankReconcilliation report. It’s a good example on how to use this functionality. 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.