default value on dialog box

hi guys… =) i’m a newbie on dynamics axapta, appreciate it very much if you guys could help me. thanku… =)

Objective: I want to create a simple report on “Customer Form” > select a particular customer > click “Functions” button > select “Open transaction editing” > then my created button named “Print Preview”. Once Print Preview button is clicked, it will show the details of my created report based on what particular transaction or line i have selected on the Open transaction editing form.

I’m thinking how the dialog box of the report could populate or get the value (“Invoice” field or column would be the best value to pass for my report) on the Open transaction editing form to pass it to the report to be generated, based on what particular line or transaction i have selected before clicking the Print Preview button.

thank you very much guys. =)

Hello,

You should use ‘args’ class to pass arguments or parameters. Please see here for more info - http://www.axaptapedia.com/Args_class

Also you did not mention which version of Ax do you use. If you are using DAX 2009, please search for ‘args’ in developers guide. There is good explanation with some examples.

Hope this helps,

Hi Harish,

I’m using AX 4.0.

On my report, i already have this methods, but i’m having a problem on initFromArgs method. it doesn’t seems to work properly because when i try to put a print ‘test’; inside the case tablenum(CustTrans) : it doesn’t return anything. On my report, i only have one Data Sources which is CustTrans table.

I do not know now what am i missing here. The objective is just to get the Invoice No. on the the Open transaction editing form to pass it to the default criteria of the dialog box once Print Preview button is clicked so that the said Invoice No would be printed on the generated report.


public void init()
{
;
element.initFromArgs(element.args());
super();
}


void initFromArgs(Args args)
{
if (args && args.dataset())
{
switch(args.dataset())
{
case tablenum(CustTrans) :
externalCustTrans = args.record();
this.query().dataSourceTable(tableNum(CustTrans)).addRange(fieldnum(CustTrans, Invoice)).value(externalCustTrans.Invoice);
break;
}
}
}

Thank you sir for your help. =)