ValueEncoding

From SMTX Wiki
Jump to navigation Jump to search

Sometimes it is important to convert the content of process values in such a way that the result can be used in either JSON, XML or HTML files, or result in a proper URL. To get this done, the standard #REPLACE-...# function can be substituted by specific functions for the desired format. For example

   #REPLACEXML-FORMFIELD-ABC# will convert the formfield ABC for usage within a XML file.
   #REPLACEJSON-TICKET-Description# will convert the ticketing description field for usage with a JSON file
   #REPLACEHTML-VARIABLE-2# will convert the variable 2 content for usage with a XML file
   #REPLACEURL-STEP-PROCESS-Name# will convert the process name for usage in a URL
   #REPLACEPLAIN-...# does no conversion and can be used to overrule system defined encoding.

The standard #REPLACE can be substituted by #REPLACEXML or any other function mentioned above in all situations. When referring to form fields, previously entered fields, variables or any other source.

Below is an example text that is encoded in 5 different ways:

Original Text

Dearest creature in creation http://,
Study "English" pronunciation.
I will // teach you in my verse;
Sounds like corpse, corps, horse, & worse.
I will keep you, #Suzy, busy,
Make your 'head' with heat grow @dizzy.
Tear in eye, your dress will tear.
So shall I! Oh hear my $prayer$.

JSON Encoding applied on this text:

"Dearest creature in creation http://,\r\nStudy \"English\" pronunciation.\r\nI will // teach you in my verse;\r\nSounds like corpse, corps, horse, & worse.\r\nI will keep you, #Suzy, busy,\r\nMake your 'head' with heat grow @dizzy.\r\nTear in eye, your dress will tear.\r\nSo shall I! Oh hear my $prayer$."

HTML Encoding applied on this text:

Dearest creature in creation http://,<br />Study "English" pronunciation.<br />I will // teach you in my verse;<br />Sounds like corpse, corps, horse, & worse.<br />I will keep you, #Suzy, busy,<br />Make your 'head' with heat grow @dizzy.<br />Tear in eye, your dress will tear.<br />So shall I! Oh hear my $prayer$.

XML Encoding applied on this text:

Dearest creature in creation http://,
Study "English" pronunciation.
I will // teach you in my verse;
Sounds like corpse, corps, horse, & worse.
I will keep you, #Suzy, busy,
Make your 'head' with heat grow @dizzy.
Tear in eye, your dress will tear.
So shall I! Oh hear my $prayer$.

URL Encoding applied on this text:

Dearest+creature+in+creation+http%3a%2f%2f%2c%0d%0aStudy+%22English%22+pronunciation.%0d%0aI+will+%2f%2f+teach+you+in+my+verse%3b%0d%0aSounds+like+corpse%2c+corps%2c+horse%2c+%26+worse.%0d%0aI+will+keep+you%2c+%23Suzy%2c+busy%2c%0d%0aMake+your+%27head%27+with+heat+grow+%40dizzy.%0d%0aTear+in+eye%2c+your+dress+will+tear.%0d%0aSo+shall+I!+Oh+hear+my+%24prayer%24.

Plain Text Encoding applied on this text:

Dearest creature in creation http://,
Study "English" pronunciation.
I will // teach you in my verse;
Sounds like corpse, corps, horse, & worse.
I will keep you, #Suzy, busy,
Make your 'head' with heat grow @dizzy.
Tear in eye, your dress will tear.
So shall I! Oh hear my $prayer$.