Using %Newline() in e-Work 6.x

The information in this article applies to product: e-Work 6.x

Issue

  • This example for the function %Replace() in the version 6.x Designer User Manual is incorrect:
    %Replace(%myMemo,%NEWLINE(),%Chr(44))

Discussion

  • In Version 6, a new XML-based Transaction Protocol (TP) was introduced.

    The most recent version of the XML Parser, which is used by the Engine, ensures that the TP XML is normalized. Part of the XML normalization process results in all line breaks being represented by a Line Feed character, %CHR(10). Until the XML is normalized, a combination of Carriage Return, %CHR(13), and Line Feed characters may represent line breaks.

    In general, all TP requests and responses passing through the Engine are normalized. However, there are some exceptions. The following list summarizes normalization of the TP XML in the Engine:

    1. Any data that comes in as a TP request is normalized as it enters the Engine.
    2. Any data that is returned from the Engine in a TP response is normalized before it leaves the Engine.
    3. Assignments to custom variables are not normalized for the duration of the request in which the assignment was made. Any processing carried out by the Engine will take place on the current values. However, a field that displays a custom variable will in effect normalize that custom variable value when it is passed back in the next TP request.

    For example, if 'When Stage Started' sets a custom variable to %NewLine, the value stored for this custom variable in the database is 'CRLF'. This remains the case until a form containing a memo field displaying this custom variable is displayed to the user. As the custom variable has been sent to the Client via the TP in XML format, its value has been normalized and the value displayed on the form is 'LF'. When the form is submitted, the value sent back to the Engine for this custom variable is 'LF'. The value stored in the database is now 'LF'.

    Process designers should be aware of this normalization process and ensure that any calculation formulas that reference a %NewLine (which returns a Carriage Return and Line Feed pair) are updated to reference a %LineFeed (which just returns a Line Feed character) where necessary. The %LineFeed function is available from Version 6.5.

Resolution

  • In version 6.x, when replacing all carriage return/line feeds in a memo field with a comma, the following syntax should be used:

    %Replace(%myMemo,%CHR(10),%CHR(44),0)

    OR

    %Replace(%myMemo,%LINEFEED(),%Chr(44)) - Version 6.5 or later

Tagged: