Data handling
Pega Robot Studio provides methods to manipulate and format data values for data types, such as strings, dates, timespan, and files. The methods are accessible from the Data Handling category of the Toolbox. You add a data manipulation method to your automation by dragging and dropping it to the automation surface.
You can also implement some data handling methods by using Expressions and Decisions. If there is a need to perform data manipulation on a particular variable, proper methods are accessible from a variable pop-up menu.
Dates
Use the Dates category to manipulate an instant in time (typically expressed as a date and time of a day) and the TimeSpan category to work on a time interval.
For example, you can get the current date and time in a DateTime format by using the Now method and then using a Compare method to determine if another date is equal before or after the current date. To assure that both dates used for comparison are of the DateTime format, use a Parse method.
The TimeSpan category expresses the difference between the two dates. For example, the subtraction of two dates that differ by a thousand days is displayed in the following image. Note that the displayed date is just under a thousand days as the program processing took some milliseconds. The TimeSpan category shows a time interval as several days, hours, minutes, seconds, and milliseconds.
The following example shows how you can use the mentioned methods in a real business scenario. A banking company has introduced a discount for a lower account maintenance fee for its clients with an account opened for more than a year.
In the following image, click the + icons to see details about using Dates and TimeSpan methods to determine if the client fulfills the condition.
Strings
The Strings category of the Toolbox provides a selection of string manipulation methods. The design blocks use a StringValue input parameter to specify the string for which you want to apply a method.
In the following example, an automation checks the customer's Note field to determine if the customer already has an assigned discount. The Contains method checks if the client's note holds a 'discount' value. If not, the method inserts a Regular customer discount message.
Files
The Files category of the Toolbox contains methods to access and manage files and directories.
After upgrading the customer to the Regular customer discount, an automation generates a report file as shown in the following example. An automation checks if the file report exists and creates a new file if a file report does not exist.
Check your knowledge with the following interaction.
This Topic is available in the following Modules:
Want to help us improve this content?