When you have to format C/AL variables (numbers, dates/times, booleans) for exchange with other apps, call FORMAT(variable,0,9) instead of simply FORMAT(variable). The format 9 formats the variable according to XML standards, and this value can then be interpreted correctly on any system with any regional settings. This is useful also when passing string-formatted values from C/AL to C# or JavaScript.
Pingback: Formatting for XML – 2/19, Navigate Into Success |
Use this function to replace the escape characters like the Ampersand.
PROCEDURE XMLEscape@11154653(Text@11154640 : Text) : Text;
VAR
Escape@11154643 : DotNet “‘mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’.System.Security.SecurityElement”;
BEGIN
EXIT(Escape.Escape(Text));
END;
Pingback: Formatting for XML - Microsoft Dynamics NAV Community