How to get data from a form to a report in AX 4.0?

Hi everybody,

Can anyone please tell me how to get data form a form to report and fetch data in a report accordingly, I mean whatever data I enter in that form, that data is getting stored in a table which is not the data source of my report but still whatever data I enter in that form should get transferred to my report and my report should fetch data from another table based on this transferred data and accordingly fetch data.

2570.VendPaymMemoFormSnapshot.GIF

In the above form I am entering

  1. Vendor account number

  2. From date

  3. To date &

  4. Cheque number

These values are getting stored in another table i.e. a table which is not a data source of my report. After this i wrote a code in OK button’s clicked method of my form. This code is as follows:-

void clicked()

{

Args args = new Args();
ReportRun reportRun;

;
args.name(reportstr(SCHLedgerJournal_CH_Duplicate));
reportRun = classFactory.reportRunClass(args);
reportRun.init();
reportrun.run();

super();

}

Then I wrote a code in init method of my report which is as follows:-

public void init()
{

;
Vpaymmemo = element.args().record(); // object of table where the data is getting stored after entering values in form.This table is not the datasource of my report.

try
{
if(element.args().record())
{

this.query().userUpdate(false);
this.query().interactive(false);
super();
}
}

catch(exception::Error)
{
info(“Error in init method”);
}

}

so even after writing the above code, the “Vpaymmemo” object(object of the table where data is getting stored after entering the values in that form) is not getting the record stored in that table due to which in fetch() of my report the data is not getting filter and it is printing all the values in my report. Please let me know where I am wrong in my code and do send any modifications if required as soon as possible.

Kindly reply me on karan.bajpeyi@minds2mentor.com

Thanks in advance.