Tag: EcapeVar
The action EscapeVar
function assigns a value to a variable (like SetVar) after having escaped its value according to target platform. EscapeVar can process several variables at once
<EscapeVar ESCAPEDtext="{%FormattedText%}" type="JS"/>
XML
Tag Attributes
Attributes | Attribute Values | Value Description |
---|
Variable Name | N/A | Any unreserved name valid in XML. Reserved names are:
Date: Current date MM/DD/YYYY Time: HH:MM;SS AM/PM
Loop Context LoopIndex: Current loop index ListSize: Current list size ListName: Current list name
FolderDocuments: Windows account Documents folder path (%USERPROFILE%\Documents) FolderTemp: Ytria temp folder path (%LOCALAPPDATA%/Ytria)
ErrorAction ErrorSystem |
Variable Value | N/A | Any string or number to escape |
CRLF | N/A | Replacement for CR,,LF or CRLF. If not supplied, CR and LF will be removed |
Type | N/A | Target platform type (Required) Accepted values: JS XML |
Example Script
<ytriaAutomation>
<calcvar FormattedText='USE_CDATA'>
<![CDATA[
var str = '\tMugre\n\tChaise\n\tCamion\n\n';
str;
]]>
</calcvar>
<echo value="FormattedText: {%FormattedText%}"/>
<EscapeVar ESCAPEDtext="{%FormattedText%}" type="JS"/>
<calcvar JSCalculated='USE_CDATA'>
<![CDATA[var str = '{%ESCAPEDtext%}' + '\tConvoy 2022\n\n';
str;]]>
</calcvar>
<echo value="Returned from JS: {%JSCalculated%}"/>
<!--calcvar v_ErrorText='USE_CDATA'>
<![CDATA[
rgx = /\[.*\]:\n([^\n]*\n).*/gs;
var str = `{%ErrorAction%}`;
rgx.exec(str)[0];
]]>
</calcvar>
<echo value="{%v_ErrorText%}"/-->
</ytriaAutomation>
XML