Formatting for XML

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.

3 thoughts on “Formatting for XML”

  1. Use this function to replace the escape characters like the Ampersand.

    PROCEDURE XMLEscape@11154653(Text@11154640 : Text) : Text;
    Escape@11154643 : DotNet “‘mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089’.System.Security.SecurityElement”;

Let me know what you think

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