Top
Top
LibraryEASYProcess Reference ManualProcessesServicesEvaluatorWorkshopSplit

Split Overview

As its name suggests, the split service is used to split a list or items into individual units for another service to use. Consider a list of things separated by a character. For example a comma separated list of letters (a,b,c,d,e). This split service will take this string and return an XML node for each letter with the corresponding letter as its value.

The split service gives us the option to choose the type of separator that is being used in the input expression. This way, in case the input list is being separated by a character other than a comma (eg. ‘#’, ‘:’, ‘;’, ‘%’ etc) we can still extract the individual entities.


Split Use Examples
Workshop:EvaluatorWorkshop
Service:Split
Inputs
Evals

This is the container node that contains all the Eval nodes. It does not accept any input, but you can Right-Click to add new Evals (Eval#0, Eval#1, etc.). Each Eval below this node can be used to store splits from various inputs.


Eval

The Eval is a container node which accepts no input but represents a single split of a list or collection. Each Eval node is indexed.


Name

This is the name of the variable used to reference the split later on in the process. For instance, a string “Example1,Example2,Example3” were being split on commas, and the name of the eval were “Test”, the result would be three nodes all named “Test”, where WorkData/Split/Test[1] would be equal to “Example1”.


Expression

This works as the input of the service. The expression is the list or collection of items that are required to be split up. An expression will generally contain multiple words which are separated from each other using a special character called the separator.


Separator

The separator is present multiple times in the expression and is a special character that is used to denote the end of one entity in the list from the beginning of another. The most commonly used separators are commas. This can become a problem is the data you are separating contains a comma (such as formatted currency). In cases like this, another separator should be chosen.

Possible Separators:

  • #EP# - The EP stands for EASYProcess. This a string that is unlikely to be in the data you are manipulating so it is often a safe choice.
  • *BLANKS -
  • *COMMA - The Comma (“,”) character is also accepted
  • *ONE B L A N K S - This refers to one space character
  • *NEWLINE - A new line character used to separate text into a new line or paragraph
  • *LENGTH(#) - The # accepted as input is the number of characters the string should be split on. For example if the word “EXAMPLE” was split on *LENGTH(3), the result would be three strings: “EXA”, “MPL”, “E”.

Split Use Examples

Basic Expression Split

In this example we will split a list of company branches that are provided in the “TestExpression”. This list is comma separated. The default separator used by the split service is also a comma.

We can see above that the seven branches mentioned in the “TestExpression” are fed into the Expression input and keeping ‘,’ as the separator we get a set of seven Branch outputs one after the other.

In order to logically use the output of the split function, the most common thing to do is to run a for-each loop over the split service. This way a process loop is created such that every time in the loop there is one item from the list which has been singled out by the Split. Here is how that looks and is created:

Splitting Process Input

In this example, we have an “Add To Cart” process which accepts as input the data on the items to be added to the cart. This means the process should have a format which allows for multiple items to be sent. One way to do this is to pass comma separated lists for each property belonging to an item and then send each of the inputs through a split service.

Here is the process canvas. Early on in the process, the input is split and then the results are looped on with a for each loop later.

Splitting Web Fields

In this example we have a table which has user input textboxes. The table has three columns. The product code, a column which denotes if order is placed or not and a user input for the product cost. Our objective here is to split these rows and the user input so that we can return a total sum of all the the products that have been ordered.

One thing to keep in mind is that web fields in EasyProcess use a special separator. The value of the separator is stored in the default AppSettings under the variable name ‘EP_Separator’. Usually we set its value to ‘#EP#’ instead of something like a comma. This comes in handy when the web fields that need to be separated themselves contain commas. Consider a table column that stores formatted dollar price values like $25,000. Such items would be correctly separated by an arbitrary ‘#EP#’ separator. It is highly unlikely that we or a client would use #EP# in the data, so this works best.

Here we are splitting both the “OrderPlaced” flag and the “ProductCost” textboxes at the same time. This way within every split we get the corresponding values paired up together row by row.

Now we set up a For-Each loop that will iterate through the results of the Split service. Before the For-Each loop begins, we set a variable “Sum” as 0. This will be our running count which will grow as we continue the loop.

Inside the Split’s for-each loop, we can first check if the “OrderPlaced” flag is true. When it is equal to “True”, we add its value to the running sum with the “Sum” Evaluate service. Finally when the loop is finished, we have our final total in the “Sum” Evaluate service.

In the SetFieldProperties, we set the “Grand Total” text box with the sum variable by referencing the “Sum” evaluate.


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