Top
Top
LibraryEASYProcess Reference ManualProcessesServicesEvaluatorWorkshopReplace

Replace Overview

Replace is a service that allows the user to choose a character or a set of characters in an expression and replace those with a new character or set of characters. The Replace service will take three inputs. The first being the InputString, which is the sentence or expression that will get parts of it replaced. The other two inputs are OldValue and NewValue, which denote which “old” character/s are going to be replaced with which “new” character/s.

Replace could be used when there is a company wide name change for a product or process. This way all the database entries can be changed and updated as required. If the phrase to be replaced is not present in the original string then the input remains untouched.

Another common use for Replace in EASYProcess is to replace the space character with an empty string. This removes all space characters from the input string.

Important: Keep in mind the replace service is case sensitive. This means if the OldValue is in lower case, then only the lower case instances of OldValue will be replaced in the InputString.


Replace Use Examples
Workshop:EvaluatorWorkshop
Service:Replace
Inputs
InputStringThe InputString is the original expression or sentence that contains the OldValue which need to be replaced by the NewValues. This is the main string that is going to be modified to create the output string.

OldValueThis is the original value, that will be replaced inside the InputString. Any instance of the OldValue in the original string will have been replaced by the end of this operation.

NewValueThis is the new value that will be inserted into the InputString in the place of the OldValue. There will be multiple instances of this NewValue in the output depending on the number of instances of the OldValue present.

Outputs
OutputStringThe OutputString will be similar to the InputString barring the fact that all the places where OldValue was found will now be replaced by whatever was defined in the NewValue.

Replace Use Example

Basic Use Example

Replace is a fairly simple service to understand and use. In the example given below, we simply create three textboxes. One for each of the inputs that we are going to provide the service.

Once we press the “Replace” button, it simply takes the inputs from the fields and runs the Replace service as per the logic specified. It replaces all the instances of ‘is’ in the InputString with the characters ‘as’. Then in the logs it will generate an OutputString with can be used by a later service to set the value of the last field.

Notice in the output there were 4 old values replaced with the new value. If the user only wished to replace the word “is” and not the letters “i-s” within other words, the input value could have been padded in space characters: “ is “.

Using Replace to Format Currency Values

Often times when currency is displayed on a webpage, it is formatted for the user. It will have dollar signs and commas or decimals. These will have to be removed if we want the currency value to be saved as an integer in a database or passed into a function which requires the integer data type.

In this example, a page called “Proceed To Pay” takes some currency values from the page and inputs them into another function which will proceed to pay the invoices the user has selected. Two of these values are the TotalAmount and OpenAmount. Below you can see part of the process canvas.

Two Replace services are being used to format the numbers by removing the commas out of larger numbers. It is replacing the comma with a blank value, or an empty string.

This blank values was created by clicking into the NewValue parameter, then looking under the “Recommended Values” in the right panel.


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