Tag Archives: strfmt

strFmt

This is an easy way to use labels and infologs in a bit more dynamic manner. It also makes it easier to do type conversion of for example dates to strings when printing to infologs.

1
2
3
4
5
6
7
8
9
10
11
12
13
static void FO_StrFmt(Args _args)
{
    CustTable   cust    = CustTable::find("4000");
    SalesTable  sales   = SalesTable::find("00697_036");
    ;
 
    info(strFmt("Hello %1!", cust.Name));
 
    info(strFmt("Hello %1, you live in %2!", 
                cust.Name, cust.City));
 
    info(strFmt("%1", sales.DeliveryDate));
}

OutPut:

Hello Light and Design!
Hello Light and Design, you live in Los Angeles!
2008-03-04

Notice that the date is presented in the format that is set up on the clients computer. In this case the Swedish format. The same format that you see in the Sales Table form.

Multiple records selected in a form

In Dynamics AX it is possible to select multiple records in any form, well at least you can if more than one record is visible. This example describes a simple way to handle the selected records before doing something with or to them. In this example we have a clicked-method on a button. If, and only if, the new field “newField” on our table “TestTable” is set on all the selected records, then the super() is run.
Continue reading Multiple records selected in a form