Expressions

String

4min

In JSONata String Functions, you can concat two strings to display multiple data records in one row or write numbers as strings, or select only a few characters from the whole string, for example, to display a person's initials.

String functions

The string functions include:

Configuration

Result

Expression

String concat expression

[email protected] & ' ' & @ctx.datasources.mydata.title

String length

=$length(@ctx.datasources.mydata.name)

Substring

=$substring(@ctx.datasources.mydata.name, 3, 5)

Substring before

=$substringBefore(@ctx.datasources.mydata.name, " ")

Substring after

=$substringAfter(@ctx.datasources.mydata.name, " ")

Upper case

=$uppercase(@ctx.datasources.mydata.name)

Lower case

=$lowercase(@ctx.datasources.mydata.name)

Evaluate PathsData

=$eval(@ctx.current.item.pathsData)

base64

"data:image/png;base64," & @ctx.datasources.mydata.data

String to number

($number(@ctx.datasources.tmra-graph.Total) >= 5)

($number(@ctx.datasources.tmra-graph.Total) < 8) ? true : false

Two-letter placeholder for avatar

=$uppercase($substring($substringBefore(@ctx.current.item.firstName, " "), 0, 1) & $substring($substringAfter(@ctx.current.item.lastName, " ") , 0, 1) )



Examples and code snippets 

String expressions
String expressions


This example shows how you can use various string functions to return data.See the full code sample in GitHub.

expression.jigx