Character Function Action

This action contains multiple functions to manipulate and parse text.

Updated over a week ago

The Character functions action provides a way to manipulate and parse text.

In each function, there are parameters to specify the source of the text. Since the text source can be stored in a variety of different places within Method, a dropdown is provided to locate where the text can be retrieved. This can range from text being manually typed in, to text in action results or controls on screen.

And, like most actions, each function asks where to store the result, whether it be an action result or a control on screen.

Since storing the function result is the same for every character function, it will not be explicitly called out.


Find in Json

Function Result: The value within a JSON given a key.

JSON (JavaScript Object Notation) is a format for structuring data. It is used to transmit data between a server and a web application and normally returned from a Call Web Service Action. 

Description

JSON text

The JSON text to parse.

Find value for key

The key to reference the value.

NOTE: When finding a value for a key, the text to find must match exactly as shown in the JSON. This includes the case of the letters: uppercase and lowercase.

JSON Examples

JSON can be tricky because of the many ways to nest values within it. For this example, we will search through the following JSON text:

{"topk1": {
"k2": "v2",
"k3": {
"k3sub": "v3sub"
},
"k4": {
"k4Array": [
{"k4a1": "v4a1", "k4a2": "v4a2"},
{"k4b1": "v4b1", "k4b2": "v4b2"},
]
}
}}

To find the value of a key, you need to prepend every parent of that key, connected with a period.

  • For example, when the key is topk1.k2 , the value returned is v2 .

  • When key is topk1.k3.ksub3 , the value returned is v3sub .

If you ask for the value of a key that has nested keys and values, you will get all of the text enclosed in brackets.

  • When key is topk1.k3 , the value returned is this subset of the JSON:

    {
    "k3sub": "v3sub"
    }
  • When key is topk1 , the value returned is the rest of the text with brackets:

    {
    "k2": "v2",
    "k3": {
    "k3sub": "v3sub"
    },
    "k4": {
    "k4Array": [
    {"k4a1": "v4a1", "k4a2": "v4a2"},
    {"k4b1": "v4b1", "k4b2": "v4b2"},
    ]
    }
    }

You can use this to your advantage by saving this into an Action Result, and using another Find in JSON function on that subset.

Arrays get a bit trickier. When the key is topk1.k4.k4Array , the value returned is the entire array:

[ 
{ "k4a1": "v4a1", "k4a2": "v4a2" },
{ "k4b1": "v4b1", "k4b2": "v4b2" }
]

To grab the values of the array, you will need to index the arraying using square brackets, starting at zero:

  • topk1.k4.krArray[0] returns

    { "k4a1": "v4a1", "k4a2": "v4a2" }
  • topk1.k4.krArray[1] returns

    { "k4b1": "v4b1", "k4b2": "v4b2" }

To get the individual elements of the array, you will need to include it in your key value query:

  • topk1.k4.krArray[0].k4a1 returns the value v4a1 .

  • topk1.k4.krArray[0].k4a2 returns the value v4a2 .

  • topk1.k4.krArray[1].k4b1 returns the value v4b1 .

  • topk1.k4.krArray[1].k4b1 returns the value v4b2 .


Find in Text

Function Result: The numerical position of some text within a larger body of text. 

Description

Find the

Select either the First or the Last occurrence of the text you want to find.

Occurrence of

The text you want to find.

Inside the text

The body of text to search through.

Starting at character

Where in the body of text to start searching through.

Find in Text Examples

The below sentence will be used for the following examples. For reference, the numbers indicate the position for those letters in the sentence.

  • First occurance of "fox" starting at character 1 will result in 17 .

  • Last occurance of letter "o", starting at character 1 will result in 42 .


Is Email Address

Function Result: True or False depending on the result.

Description

Is this an email address?

Provide an email or a comma-separated list of emails.


Is Date / Empty / Numeric

Function Result: True or False depending on the result.

Is Date Parameter

Description

Is this a date?

The value you want to test.

Is Empty Parameter

Description

Is this empty?

The value you want to test.

Is Numeric Parameter

Description

Is this a number?

The value you want to test.


Join

Function Result: Text created from the joining of provided texts.

Description

Join this

The first piece of text.

With this

The second piece of text to join at the end of the first.

⊕ Add another join

Bring up another field to join more text

Separate joins with

From the dropdown, select what to insert between the two joined texts:

  • Custom text

  • Comma [ , ]

  • New Line

  • No Separator

  • Space []

  • Pipe [ | ]

Join Example

In this example, we will use two words to join:

  • Join this: first

  • With this: second

and display what each looks like with each separator:

  • Custom text (i.e. "myWord"): firstmyWordsecond

  • Comma: first,second

  • New Line:

    first
    second
  • No separator: firstsecond

  • Space: first second

  • Pipe: : first|second


Left

Function Result: Extracted text from a given text.

Description

Extract text from

The text to extract from.

Search using

Position

Return this many characters starting from the left:
Return stated number of characters starting from the beginning of the text.
​Example: If the original text is "abcde" and 2 characters are set to be returned, then the result is "ab".

Search using

Text

Return all characters before this:
Return all characters before stated search text.
​Example: If the original text is "abcde" and we set the text to "de", then the result is "abc".


Right

Function Returns: Extracted text from a given text.

Description

Extract text from

The text to extract from.

Search using

Position

Return this many characters starting from the right:
Return stated number of characters starting from the end of the text.
​Example: If the original text is "abcde" and 2 characters are set to be returned, then the result is "de".

Search using

Text

Return all characters after this:
Return all characters before stated search text.
​Example: If the original text is "abcde" and we set the text to "bc", then the result is "de".


Middle

Function Returns: Extracted text from a given text

Description

Extract text from

The text to extract from.

Search using

Position

Extract text based on a numeric position.

  • Return this number of characters: How many characters to return.

  • Starting at position: numerical position to start.

​Example: If the original text is "abcde", and we want to return 2 characters starting at the 3rd position, then the result would be "cd".

Search using

Text

Return text between two text values.

  • Return characters between this: Start extraction after this text.

  • And this: Complete extraction before this text.

Example: If the original text is "abcde", and we want to return characters between "ab" and "de", then the result would be "c".


Length

Function Returns: The number of characters in a given text.

Description

Return the number of characters in

The text to count characters.


Replace

Function Returns: the text with replacements specified.

Description

Within text

The text to update with replacements.

Replace this

The text to search for.

With this

The replacement text.

Replace Example

If Within text is

I read the book "{{TITLE}}".

And Replace this is set to {{TITLE}} ,

While With this is set to The Little Prince,

Then the result will be:

I read the book "The Little Prince".

Note the use of the curly brackets: {{}}. This is to ensure no other word with the text of TITLE would accidentally be replaced.


Replace Merge Fields

Function Returns: the text with merge fields replaced

A merge field allows you to pull in field values from a table to be put into text, often used for email templates. For example, here is some text with a merge field:

Dear Contacts.Name,
It was good to meet you.

The merge field is Contacts.Name. The first part before the period specifies the table, "Contacts" and the second part refers to the field in the table "Name".

Given a Record ID to specify a particular record, the merge field in the above text will be replaced with the value taken from the Name field of that record in the Contacts table.

Description

Using This Text

The text with the merge fields.

Merge Data from This Table

The table to retrieve values from. (A list of tables will not be pulled. You will need to type in the table.)

Using this RecordID

The Record ID of the record to retrieve values from.

Merge Field Example

In this example, we want to merge Amy Ford's contact information. Note that her RecordID is 3, which uniquely identifies Amy Ford's record.

Now we will use this body of text for the Using This text field:

Dear Contacts.FirstName,
It was good to meet you. Is this your correct phone number?

Contacts.Phone

When we use the Record ID of 3, which identifies Amy Ford, it will pull in the two pieces of data that corrpespond to the merge fields. The resulting text would be:

Dear Amy,
It was good to meet you. Is this your correct phone number?

(630)555-3393


To Upper/Lower/Title Case

Function Returns: the text changed to the specified case

The three functions mentioned are:

  • Lower case: all text is converted so there are no capital letters.

  • Upper case: all text is converted to capital letters.

  • Title case: each word is capitalized.

Description

Convert this to lower/upper/title case

The text to convert.

Did this answer your question?