
If it's possible, I would like to hide a date field and it's label on a report using a dialog field. For example, when the user runs the report he/she is prompted for a date range plus there is a box to check to indicate whether or not they want this date on the report. If box is checked include date field, if not checked hide the date field.
Any ideas, suggestions, or examples would be greatly appreciated as I am very new to AX and X++ coding.
Thanks in advance,
Gary
*This post is locked for comments
I have the same question (0)Hey Gary,
A good example for this, among many, is the SalesHeading report. (Found in AR > Reports > Transactions > Sales Order > Sales order.
There are two check boxes on the dialog box.
You can look in the dialog() method to see how these are added to the dialog:
fieldFormLetters = dialog.addFieldValue(typeid(NoYes), formLetters, "@SYS1402", "@SYS83391");
fieldTotals = dialog.addFieldValue(typeid(NoYes), totals, "@SYS8311", "@SYS83393");
Then in the fetch() method, certain controls visible properties are set to false based on the check boxes values. So in the following if forms and totals check boxes are not checked, set the visible property to false for some of the reports controls:
public boolean fetch()
{
boolean ret;
;
if (!formLetters)
{
lastPackingSlipDate.visible(false);
lastPackingSlip.visible(false);
lastInvoiceDate.visible(false);
lastInvoice.visible(false);
}
if (!totals)
{
salesTable_CurrencyCode.visible(false);
salesTable_OrderedAmount.visible(false);
salesTable_InvoicedAmount.visible(false);
contributionMargin.visible(false);
}
ret = super();
return ret;
}
Simple as that! :)
Hope this helps.
Kind regards.