String
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
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) )
Be careful when using complex expressions, such as expressions that iterate one datasource across another, as your solution performance could become slower. To avoid this, try to use the datasource queries to get the desired result rather than an expression.
Examples and code snippets

This example shows how you can use various string functions to return data.See the full code sample in GitHub.
Last updated
Was this helpful?