Basic X++ programming question: DateEdit Control

I have 2 simple problems that I cannot solve (due to having no documentation):

  1. I have an DateEdit text field on a form - I have overwritten a ‘clicked()’ attached to a button on the form - when I click the button, I just want the date in the DateEdit text field to appear in a box::info… How do you grab that date value from the text field? I have tried referencing the DateEdit text field directly, and get the following error:

*** Error: 7, the table does not contain this field.

I have also tried supplying a default value, by associating the DateEdit text field with a table (this supplies the little calendar box you can click on, then select a date) - this does not error - but the recid is always zero/null - I cannot get the clicked() method to understand that I want to get the date from this field - anyone know how this is supposed to be done?

Thanks in advance

In order to use a form control in code you can follow one of the paths: 1. Set the AutoDeclaration property on this control to Yes and then in code simply address this variable. For example if the control name is DateEditMy, you would write the following code: box::info(strFmt("%1", DateEditMy.dateValue())); 2. use the inbuild controls enumeration on the form. FormDateControl datecontrol; ; datecontrol = element.control(Control::DateEditMy); box::info(strFmt("%1", datecontrol.dateValue())); Obviously, most people prefer the first option :slight_smile: Also, I would definitely recommend reading the DevGuide, or a book on Dynamics AX development.