# Add DialogField in report dialog box

**URL:** <https://www.dynamicsuser.net/t/add-dialogfield-in-report-dialog-box/51672>\
**Category:** Technical Forum\
**Created:** [March 24, 2014, 12:48pm UTC](https://www.dynamicsuser.net/t/add-dialogfield-in-report-dialog-box/51672 "2014-03-24T12:48:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hariharans87](https://avatars.discourse-cdn.com/v4/letter/h/e79b87/32.png) [@hariharans87](https://www.dynamicsuser.net/u/hariharans87)\
**Post date:** [March 24, 2014, 12:48pm UTC](https://www.dynamicsuser.net/t/add-dialogfield-in-report-dialog-box/51672/1 "2014-03-24T12:48:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MartinDrab](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@MartinDrab](https://www.dynamicsuser.net/u/MartinDrab)\
**Post date:** [March 24, 2014, 1:36pm UTC](https://www.dynamicsuser.net/t/add-dialogfield-in-report-dialog-box/51672/2 "2014-03-24T13:36:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hariharans87](https://avatars.discourse-cdn.com/v4/letter/h/e79b87/32.png) [@hariharans87](https://www.dynamicsuser.net/u/hariharans87)\
**Post date:** [March 24, 2014, 7:21pm UTC](https://www.dynamicsuser.net/t/add-dialogfield-in-report-dialog-box/51672/3 "2014-03-24T19:21:32Z")

</div>

Hi Martin,

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

Thanks,

Hari

---

<div class="post-metadata">

**Author:** ![MartinDrab](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@MartinDrab](https://www.dynamicsuser.net/u/MartinDrab)\
**Post date:** [March 26, 2014, 1:09pm UTC](https://www.dynamicsuser.net/t/add-dialogfield-in-report-dialog-box/51672/4 "2014-03-26T13:09:53Z")

</div>

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.
