Top
Top
LibraryEASYProcess Reference ManualProcessesProcess CanvasService CanvasFunctions

Functions Overview

When developing in EASYProcess processes, there are some functions available to make developments easier. There are two categories: EASYProcess functions and XSLT functions. EASYProcess functions are custom EASYProcess XSLT functions. These are special functions that allow XSLT to call C# code in the background. XSLT 1.0 functions are supported by EASYProcess.


EASYProcess CallProcess
EASYProcess ResolveUrl
EASYProcess GetDate
EASYProcess HTMLEncode/HtmlDecode
EASYProcess Wrap/Unwrap XML
EASYProcess ToLower/ToUpper
EASYProcess GetMessage
EASYProcess Math
EASYProcess Replace
EASYProcess Pad
EASYProcess Currency

EASYProcess CallProcess

This is a function that can be used to call an EASYProcess process via XSLT and retrieve a value from its output. Running the EASYProcess function calls the process and generates logs for the process called in EASYProcess (provided logs are turned on).

Similar to XSLT Value-Ofs, in the logs, you will not see that an XSLT variable was used. You will only see the the variable referenced in the logs. The process called will generate logs, but the parent process (where CallProcess function is used) will not have a reference to the process.

Syntax

<xsl:value-of select="EASYProcess:CallProcess('[ProcessId]','[Input]')"/>

Example:

<xsl:value-of select="EASYProcess:CallProcess('PRC-10000369','123')"/>

<xsl:value-of select="EASYProcess:CallProcess('PRC-10000369','')"/>

Input

This function takes two inputs: the process id and a single parameter. This parameter will be passed in as WorkData/Input/Input1 to the process called.

Multiple Parameters Needed

If multiple inputs are needed by the process, a comma separated list could be passed as a single string in the one allowed parameter for the function. The called process would then have to split on the commas to have access to the values.

No Parameter Needed

If no parameter is needed, the function still needs the second input to be passed. In this case, an empty string should be passed instead.

Output

The output is retrieved from WorkData/[AnyValue]/Output. It is pulled from the first value found in the process.

CallProcess Function Used in an Inquire

The Inquire Input XML Once Converted by EASYProcess

The Called Process’s Output Node as Seen in Process’s Logs

The Inquire Output Once Converted By EASYProcss CallProcess Function

No Value Found

If no value is found, the function will return an error. Null is not a valid response from the CallProcess function.

Output From EvaluateXml

When using EvaluateXml to output the processes return value, a different syntax can be used. WorkData/Output will work as long as it uses simple XML tags inside the EvaluateXml:

When the XML is copied from the EvaluateXml service itself (with the additional properties added by EASYProcess), it is not recognized as an output node and it will either look for the next possible output value or find none and throw an error.


EASYProcess ResolveUrl

ResolveUrl can be used to change relative URLs to full URLs. This could be done by using a GetWebsiteProperties service to retrieve the root url and append the rest, but this EASYProcess function could also accomplish this.


EASYProcess Get Date XSLT Functions

All Get Date functions called with no arguments will return the current date and time in the correct format. Passing a DateTime as a string will convert the DateTime to the format. A DateTimeString is a string in the format MM/DD/YYYY hh:mm:ss xm.

Function

Return string format

GetEPLongDate()

GetEPLongDate(‘DateTimeString’)

YYYY/MM/DD hh:mm:ss

GetEPShortDate()

GetEPShortDate(‘DateTimeString’)

YYYY/MM/DD

GetLongDate()

GetLongDate(‘DateTimeString’)

M/D/YYYY h:mm:mm xm

GetLongDateUTC()

GetLongDateUTC(‘DateTimeString’)

YYYY/MM/DD hh:mm:ss

GetShortDate()

GetShortDate(‘DateTimeString’)

M/D/YYYY h:mm:ss xm

GetShortDateUTC()

GetShortDateUTC(‘DateTimeString’)

YYYY/MM/DD


EASYProcess HtmlEncode XSLT Function

The HtmlEncode(‘string’) function takes a string as an input and encodes it by escaping special characters. This does the same thing as the HtmlWorkshop Service UrlEncode. For example <xsl:value-of select="EASYProcess:HtmlEncode('this is a test  & <>')"/> will return: this is a test  &amp; &lt;&gt;

EASYProcess HtmlDecode XSLT Function

The HtmlDecode(‘string’) function takes a string as an input and decodes it by unescaping special characters. This does the same thing as the HtmlWorkshop Service UrlDecode. For example <xsl:value-of select="EASYProcess:HtmlEncode('this is a test  &amp; &lt;&gt;')"/> will return: this is a test  & <>


EASYProcess WrapXml XSLT Function

WrapXml(‘value’) takes in a string and replaces < with <, > with >, and & with &. For example <xsl:value-of select="EASYProcess:WrapXml('<TestNode>MyTestString</TestNode>')"/> will return: #EPGT#MyTestString#EPGT#

EASYProcess UnwrapXml XSLT Function

UnwrapXml(‘value’) takes in a string and replaces < with <, > with >, and & with &. For example <xsl:value-of select="EASYProcess:UnwrapXml('#EPGT#MyTestString#EPGT#')"/> will return: <TestNode>MyTestString</TestNode>


EASYProcess ToLower XSLT Function

ToLower(‘input’) takes a string as an input and will convert all characters to lowercase. For example <xsl:value-of select="EASYProcess:ToLower('TEST')"/> will return: test. This does the same thing as the String/Math Operations ToLower service.

EASYProcess ToUpper XSLT Function

ToUpper(‘input’) takes a string as an input and will convert all characters to uppercase. For example <xsl:value-of select="EASYProcess:ToUpper('test')"/> will return: TEST. This does the same thing as the String/Math Operations ToUpper service.


EASYProcess GetMessage XSLT Function

The GetMessage(‘messageName’) takes a string as an input and returns the message associated with the message name. The message name must exist in the application database table EP_Messages. An example is <xsl:value-of select="EASYProcess:GetMessage( '004')"/> will return: Message User Id/Password invalid. Since message 004 is defined in the table.


EASYProcess Math XSLT Function

Math(‘expression’, ‘decimalPrecision’) takes two strings an inputs. The first string is an expression that you want to compute and the second is how many digits after the decimal you want to be returned. The function can also be called as just Math(‘expression’) and this will default the decimalPrecision to 0.

A simple example:

<xsl:value-of select="EASYProcess:Math('1 + 1.16')"/> returns: 2

<xsl:value-of select="EASYProcess:Math('1 + 1.16', '0')"/> returns: 2

<xsl:value-of select="EASYProcess:Math('1 + 1.16', '1')"/> returns: 2.2

<xsl:value-of select="EASYProcess:Math('1 + 1.16', '2')"/> returns: 2.16

<xsl:value-of select="EASYProcess:Math('1 + 1.16', '3')"/> returns: 2.160


EASYProcess Replace XSLT Function

The Replace('input','fromString','toString') function takes three strings as input. The first is the input string in which you will be replacing parts of. The second is the part of the first string you wish to replace. The third is what you are going to replace the second with. This does the same thing as the String/Math Operations service Replace. For example: <xsl:value-of select="EASYProcess:Replace('This is a test',' ','')"/> will output: Thisisatest

EASYProcess RegexReplace XSLT Function

This is similar to the replace function but now you can use a regular expression to match what you wish to replace. RegexReplace('input','pattern','toString') function takes three strings as input. The first is the input string in which you will be replacing parts of. The second is the regular expression pattern that will be replaced. The third is what you are going to replace the second with. <xsl:value-of select="EASYProcess:RegexReplace('This is a test','\s','')"/> returns: Thisisatest


EASYProcess PadLeft XSLT Function

The PadLeft('input',totalLength,'character') function takes in three inputs. The first is an input string that you wish to add padding to. The second is the length that you wish the string to be at. The third is the character that will be added to the string to make it the desired length. This function will add the character to the left of the string. For example <xsl:value-of select="EASYProcess:PadLeft('M30',12,' ')"/> becomes ‘         M30’

EASYProcess PadRight XSLT Function

The PadRight('input',totalLength,'character') function takes in three inputs. The first is an input string that you wish to add padding to. The second is the length that you wish the string to be at. The third is the character that will be added to the string to make it the desired length. This function will add the character to the right of the string. For example <xsl:value-of select="EASYProcess:PadLeft('M30',12,' ')"/> becomes ‘M30         ’


EASYProcess ParseCurrency XSLT Function

The ParseCurrency('input') function takes a string as an input and is used to check to see if the string is a numeric value.

<xsl:value-of select="EASYProcess:ParseCurrency('$10.00')"/> returns 10.00

<xsl:value-of select="EASYProcess:ParseCurrency('10.00')"/> returns 10.00

<xsl:value-of select="EASYProcess:ParseCurrency('10.0&0')"/> returns NAN


Powered by EASYProcess (© 2019 K-Rise Systems, Inc).