April 08, 2013

Create a From through X++ Job

Hi,
Here is small code for create a AX From through X++ Job code.

static void theaxapta_formJob(Args _args)
{
    Form                    form;
    FormRun                 formRun;
    Args                    args;
    FormBuildDesign         formBuildDesign;
    FormBuildControl        formBuildControl;
    FormBuildTabControl     formBuildTabControl;
    FormBuildTabPageControl formBuildTabPageControl;
    FormBuildGridControl    formBuildGridControl;
    FormBuildDatasource     formBuildDatasource;
    FormBuildStringControl  formString;
    ;
    form = new Form();
    formBuildDatasource     = form.addDataSource(tableStr(PurchTable)); // Main Data Source for FORM
    formBuildDesign         = form.addDesign('design');// Add design in FORM
    formBuildTabControl     = formBuildDesign.addControl(FormControlType::Tab, 'Tab');
    formBuildDesign.height(1000);
    formBuildDesign.width(1000);
    formBuildTabPageControl = formBuildTabControl.addControl(FormControlType::TabPage, 'TabPage');
    formBuildTabControl.height(500);
    formBuildTabControl.width(500);

    formBuildGridControl    = formBuildTabPageControl.addControl(FormControlType::Grid, 'Grid');
    formBuildTabPageControl.height(500);
    formBuildTabPageControl.width(100);

    formString              = formBuildGridControl.addDataField(formBuildDatasource.id(), fieldNum(PurchTable, PurchId));
    formString.label("Purchase Order Form");

    args    = new Args();
    args.object(form);
    formRun = classFactory.formRunClass(args);
    formRun.init();
    formRun.run();
    formRun.wait();
}


-Harry

April 06, 2013

UTC DateTime Null Value in Ax

UTC DateTime Null Value in Ax

Some times we need to pass or check null value in UTCDateTime field.
so here is the logic to pass null value in UTCDateTime,

just try utcdatetimenull() function in your code, it will return the same value as 

DateTimeUtil::minValue() function.

In X++ The utcdatetimenull() value is '1900-01-01T00:00:00'.

-Harry