Code of Buttons

Please someone can help me to solve these tasks!

A Dynamics NAV table (1234567500) with decimal numbers of the form is given:

Feldname Type Length Meaning Key
INDEXNR Code 30 sequential number yes
CONVERSION Decimal article

Indicate the C/AL code of a Buttons, which adds and as Message box shows the conversions.

Indicate the C/AL code of a Buttons, which counts and as Message box shows the number of data records in the table.

Hi Sayazd,

If I may suggest You to use the C/AL Symbol Menu (F5), combined with the help (F1), while in design-mode, You’ll be able to find a lot of help on the syntax of C/AL.

For this You need to define CONVERSION as SumIndexField on one of the keys in the source-table.

Button-code:
CALCSUMS(CONVERSION);
MESSAGE(Text001,CONVERSION);

Button-code:
MESSAGE(Text002,COUNT);

Thank you very much, Alexander!

You can to me please explain which the variables Text001/002 to mean?

Regards,

Daniel,
Student

Hi,

Text0001/0002 are “Text Constants” you define in the “C/AL Globals” menu option, you can accede there when you are editing the “C/AL Code” of your object (table, form…). For example you can assign to Text0001 the text 'The value of the conversion is:"…

when you will write the message “MESSAGE(Text0001 %1, CONVERSION)” it would appear something like:

‘The value of the conversion is: 25’. OK? [:D]

That is correct Carlos,

But…
The %1 needs to be either “inside” the text-var (e.g. Text001 - ‘The value of the conversion is: %1’), or You need to do it as adding another text-string to Text001 (e.g. MESSAGE(Text001 + ’ %1’,CONVERSION))

Upppssss,

you’re right… I was thinking in a literal text message (MESSAGE(‘The value is: %1’, VAR)) [H]

Just thought I would add a point here. The reason for these Text constants is to allow the use of MultiLanguage in Navision.

Even thought you may develop in only one language it is still standard to use these Text Constants, and I personally think it makes your code look neater.

//TH