Thursday, October 13, 2016

AX 2012 AX 2009 - Pass temp table to Form/Report AX2012 AX2009

To run the report/form from class with temp table as record set.

Class method to populate records in temp table and call the form.

public void run()
{
      Args  args;
      Formrun formRun;
      InventTable  inventTableTmp;

      inventTableTmp.setTmp();
     
     while select inventTable // add your condition
     {
         inventTableTmp.data(inventTable.data());
         inventTableTmp.doinsert(); 
     }

     args = new Args(reportStr(MyFormName));
     args.record(inventTableTmp);

     formRun = new Formrun (args);
     formRun .init();
     formRun .run();

}

//Form methods to receive the record set argument
public class FormRun extends ObjectRun
{
     InventTable  inventTable;

}

public void init()
{
    super();

    if (element.args().dataset() == tableNum(InventTable))
    {
        inventTable = element.args().record();
        // Now you have the inventtable record set, you assign this to form data source for display
    }

}


Happy DAXing...


No comments:

Post a Comment