Text expressions

Modified 4 years ago

Neil

Text expressions can be used with text fields. Text area fields cannot use expressions. 

Kissflow will sometimes refer to a sequence of characters in an expression as a string. Strings are parts of text expressions. 

Example fields

For all of these examples, let’s assume that we have the following text field:

Field ID

Field Type

Value

text1

Text

Stark Industries

Functions

A function goes at the start of the expression. 

Function

Description

Syntax

Output

Concatenate

Connects up to 255 strings

CONCATENATE(text1, “, Inc”)

Stark Industries, Inc

Methods

Methods come after the fieldID and are called up with a dot operator. 

Function

Data type

Description

Syntax

Output

toUpperCase

Text

Makes all characters upper case.

text1.toUpperCase()

STARK INDUSTRIES

toLowerCase

Text

Makes all characters lower case.

text1.toLowerCase()

stark industries

trim

Text

Removes any spaces at the start and end.

text1.trim()

Stark Industries

replace

Text

Replaces case-sensitive characters with others.

Specify which occurrence of the character you want to replace.

text1.replace("s", "x")

text1.replace("s", "x", 2)

Stark Induxtriex

Stark Industriex

find

Number

Shows the first location of a character in a string.

Add from which position to start looking.

It is case sensitive by default; to make it insensitive, add true(). 

text1.find("s")

text1.find(“s”, 12)

text1.find(“s”, 1, true())

11

16

1

substring

Text

Shows a defined range of characters in the string.

text1.substring(1,3)

Sta

length

Number

Shows the number of characters in a string.

text1.length()

16

Converting values to a text field

The toText method converts different data types to a text field. 

Here are some more sample field IDs and values:

  • NumField = 24.526
  • CurField = USD $24.52
  • DateField = 05/29/1971
  • Datetimefield = 05/29/1971 9:35 AM

Change

Description

Syntax

Output

Number to Text

Converts a number value to a text value.

Add formatting options to give placeholders. 

When decimal places are included, the number will be rounded.

numfield.totext()

numfield.totext(“.00”)

numfield.totext("0000")

“24.526”

“24.53”

"0024"

Currency to Text

Converts a currency value to a text value.

Add formatting options. 

curfield.totext(“0.00”)

“24.50”

Date to Text

Converts a date value to a text value.

DD=Day

MM=Month

YY, YYYY=Year 

datefield.totext(“DD/MM/YY)

“29/05/71”

Datetime to Text

Converts a datetime value to a text value.

24 hour format - HH=Hour, MM=Minute

12 hour format - H:M

AM/PM displays AM or PM

datetimefield.totext(“DD/MM/YY H:M AM/PM”)

“29/05/71 09:35 AM”

1. To use real-time exchange rates, use a remote lookup field

Method

Syntax

Input type

Output type

Explanation

extractText

Remotelookup_Fieldname.extractText(<path>, <index>)

Remotelookup_Fieldname: JSON OBJECT<path>: TEXT (valid json path)<index>: TEXT

LIST{TEXT}TEXT

Extracts and returns a text array from the JSON object as filtered by the provided json path. If the index is provided then the text in the particular index is extracted.

Did you find the article helpful?

Powered by HelpDocs (opens in a new tab)