Add DialogField in report dialog box

I have to add some checkbox fields on the report dialog box. Based on the selected checkbox, I have to visible or invisible the report field like on hand inventory report.
Example: Here, I have added the checkbox for site id.
Class declaration:
DialogField fieldSiteId;

Dialog method:
dialog.addGroup(‘View’);
fieldSiteId = dialog.addField(typeid(NoYesId));
fieldSiteId.value(1);
fieldSiteId.label(‘Site id’);

Run method:
public void run()
{
if(any2int(fieldSiteId.value()) == 0)
{
InventSite_InventSiteId.visible(false);
}
super();
}

It is working fine, but my doubt is that is it correct way?

Thanks,
Hari

What’s your version of AX? Do you think that your solution would work if you sent the report to batch?

Hi Martin,

My AX version is AX 2009. I don’t know about report to batch. Please guide me.

Thanks,

Hari

You should use basically the same approach as with RunBase classes. Get the value in getFromDialog() and save it to a variable. Then implement pack()/unpack(), so the value doesn’t get lost when switching from client to server or when saving for batch processing.

You’ll find many examples in AX, e.g. in AssetBasis report.