1. Home
  2. Workflows
  3. Working With Strings

Working With Strings

Strings are one of the more common data types used in Bosbec WE, and learning how to use and manipulate them is essential. Strings are a series of characters most often intended to be read and understood by the user. Simply put, strings are text. For example, the message content of an SMS, the name of the sender, or a message identifier used to find the specific message can all be stored as strings.

While most jobs handle strings in some form or another, creating and manipulating strings in the workflow builder is commonly done using the “Data Operations” job. “Data Operations” is a sub-process job in which, amongst other things, you can create or get strings in various ways and store them in the workflow context or more permanently on units and in the data log. This article is an introduction to some of the most common ways to handle strings in the Workflow Builder.

Set data

With the set data operation, you can either get a string from the metadata in the workflow context or by entering it yourself. Getting metadata in a set data operation is done using the below syntax.

metadata.key

If you want to set a static value in the destination, you can simply type it out.

Concat

If you have two different strings that you want to combine, or if parts of the string should be dynamic, you can use the Concat operation in the Data operation job. This is done by adding the dynamic data in the following syntax:

{metadata.key1} {metadata.key2}

Adding a colon to the end of the string allows you to enter a default value, in case the key does not exist.

{metadata.key:Not found}

Building a string where only part of it is dynamic is done by simply adding the above syntax into the string. An example below:

You’re scheduled for an appointment on {metadata.date} at {metadata.time}.

Regular expressions

There are four operations in the job that allows you to use RegEx to extract, insert, remove, or replace text in the strings. Enter your RegEx pattern in the pattern field.

It is worth noting that as we are currently using the same text fields for all properties windows, the characters in the RegEx may be escaped behind the scenes but not shown as such. To ensure that there are no additional characters in the pattern, see the JSON-view instead.

Split String

If you need to split a string on a specific delimiter, you can use the Split string operation. Get your string in the source field, select a key for the result, and select which character you want to split on.

In the example below, the key will be item_0, item_1, item_2, and so on, for each resulting string.

If you want the result to be saved as a string resource instead of metadata, simply enter a resource name in the Result as resource field.

Substring

Sometimes, it may be important that a string is no longer than a specific amount of characters. This is solved by using the Substring operation.

Select a source and destination, choose at which position the substring should start, and enter a max length. If you have the index or max length in metadata, rather than a static number, you can use the source fields.

Encode Decode

A string can also be encoded or decoded to and from string, base64, hex, HTML, or URL using the Encode Decode operation. The different types are available in the dropdown.

Updated on 2023-10-05

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support