MESSAGE('hello, world!');
Variables in C/AL are not defined through code, but are defined via the variable declaration menu in the C/AL editor. In this example Item is assumed to be a variable of type Record.
IF Item.GET('31260210') THEN
MESSAGE(STRSUBSTNO('Item name is: %1',Item.Description));
Item.RESET;
Item.SETRANGE("No.",FromItem,ToItem);
Item.FINDLAST;
Looping over a recordset and modifying the individual records is achieved with only a few lines of code.
Item.RESET;
Item.SETRANGE("Blocked",TRUE);
IF Item.FINDSET THEN
REPEAT
IF Item."Profit %" < 20 THEN BEGIN
Item."Profit %" := 20;
Item.MODIFY(TRUE);
END;
UNTIL Item.NEXT = 0;
Item.MODIFYALL("Blocked",FALSE);