Export (0) Print
Expand All

UPDATE Function (Dialog)

Microsoft Dynamics Nav 2009

Updates the value of a '#'-or '@' field in the current window.


Dialog.UPDATE([Number] [, Value1])

Parameters

Dialog

Type: Dialog

The dialog you want to update.

Number

Type: Integer

Each '#' or '@' field has a specific number. The Number argument tells the system into which field it should insert Value. If you omit this parameter, all '#' or '@' fields in the current window are updated.

Value

Type: Any

This value (or expression) can be any simple C/AL data type such as Boolean, option, integer, decimal date, time, text and code. If you omit this value, then the value from the variable in the OPEN Function (Dialog) call is used.

When you have a function that contains Dialog.UPDATE(Number,Value) and the value is a variant, you must format the text constant to ensure that the variant type can understand the text constant.

In C/SIDE, the text constant is read as type AL_TEXTCONST, which cannot be interpreted by the variant.

You can use the FORMAT Function (Code, Text) to convert the text constant to a string type, which can be interpreted and displayed by the variant.

The following example shows how to update '#' fields in a window.

This code example requires that you create the following variables and text constants in the C/AL Globals window.

Variable name DataType Length

AccountInfo

Text

1024

AccountNo

Integer

 

TotalSum

Decimal

 

MyDialog

Dialog

 

Text constant name Constant value

Text000

Account no. #1######\

Text001

shows a total of $ #2######

AccountInfo := Text000 + Text001;
AccountNo := 5634;
TotalSum := 1000;
MyDialog.OPEN(AccountInfo); // Opens a window with '#'-fields.

SLEEP(5000);
MyDialog.UPDATE(1, AccountNo); // Fills in field 1.
SLEEP(5000);
MyDialog.UPDATE(2, TotalSum); // Fills in field 2.
SLEEP(5000);

When the dialog window first opens, the following information is displayed:

Account no. . . . . shows a total of $. . . . . . .

After the first SLEEP call, the value of the AccountNo variable is inserted. After the second SLEEP call, the value of the TotalSum variable is inserted.

Community Additions

ADD
Show:
© 2014 Microsoft