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.
Formatting for XML
- Post published:February 19, 2015
- Post category:Uncategorized
- Post comments:3 Comments
- Reading time:1 mins read
Vjeko
Vjeko has been writing code for living since 1995, and he has shared his knowledge and experience in presentations, articles, blogs, and elsewhere since 2002. Hopelessly curious, passionate about technology, avid language learner no matter human or computer.
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