Word Layout reports data control by C/AL

word layout

Some have asked me (both on Dynamics Community and Mibuso) how to use in NAV Word Layout reports property to hide the value 0 or other values in fields under conditions.

Sample of question: “I have made a report in NAV 2016 using Word and XML. Everything is very well, but I have one problem. When “quantity” is added to the report, writes NAV “0” in all cells with no information. In the attached picture saying “with error” you can see That the “quantity” cell with no information is filled with “0”.”

Question ref. http://forum.mibuso.com/discussion/67111/nav-2016-word-report-is-generating-extra-0
No, only in C / SIDE in this case (simple common solution), the use in this way (no logic in Word, all in C (SIDE) .. but .. i think That you can create functions in Word (macro) ,in word template. you can modify XML an add also Javascript support… an so on..”

Some functions can be used with C / AL
With these sample functions you can simulate what is done by the visibility property of the RDLC report or by VBNET Functions included in the report (Public Functions on CODE section of reports).


Num2Str (IdecValue: Decimal) OtxtValue: Text [100]
IF IdecValue <> 0 THEN BEGIN
OtxtValue: = FORMAT (IdecValue, 0, ‘<Precision, 2: 2> <Standard Format, 0>’);

Num2Str2 (IdecValue: Decimal) OtxtValue: Text [100]
OtxtValue:=FORMAT(IdecValue,0,'<Precision,2:2><Standard Format,0>’);

Int2Str (inValue: Integer) OtxtValue: Text [100]
IF inValue <> 0 THEN BEGIN
OtxtValue: = FORMAT (inValue);
etc etc.

3 thoughts on “Word Layout reports data control by C/AL

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.