Upsolver
Search…
Structural functions
This page goes over the structural functions in Upsolver.

FROM_KEY_VALUE

Maps a list of key values to a record with fields for each key.

Inputs

  • key
  • value

Properties

  • Keys

Example

Input
1
{
2
"data": [
3
{ "key": "a", "value": 1 },
4
{ "key": "b", "value": 2 }
5
]
6
}
Copied!
SQL
1
SET result = FROM_KEY_VALUE('a,b', data[].key, data[].value)
Copied!
Result
1
{
2
"result": {
3
"a": 1,
4
"b": 2
5
}
6
}
Copied!

GET_RANGE

Returns range of numbers between start and end (inclusive).

Inputs

  • first
  • last

ITEM_INDEX

Gets the index of the item.

Properties

  • Global Index - Use the global index in the event instead of the index in the containing array
  • Count Nulls

JSON_PATH

Extracts data from JSON objects.

Inputs

  • JSON - A String that contains JSON Document

Properties

  • Path - JSON Path Expression
JSON
Path
result
"[{ "name": "The Great Gatsby", "author": { "name": "F. Scott Fitzgerald" } }, { "name": "Nineteen Eighty-Four", "author": { "name": "George Orwell" } }]"
"$[*].author.name"
"F. Scott Fitzgerald", "George Orwell"
"{ "net_id": 41 }"
"net_id"
"41"
"{ "net_id": [41, 42] }"
"net_id"
"[41, 42]"
"{ "net_id": [41, 42] }"
"net_id[*]"
"41", "42"
"{ "net_id": [41, 42] }"
"net_id.parent"
null
"[1,2,3]"
"$[*]"
"1", "2", "3"
"[{ "name": "The Great Gatsby", "author": { "name": "F. Scott Fitzgerald" } }, { "name": "Nineteen Eighty-Four", "author": { "name": "George Orwell" } }]"
"$[*].author.name"
"{"name":"F. Scott Fitzgerald"}",
"{"name":"George Orwell"}"

JSON_TO_RECORD

Extracts data from JSON objects.

Properties

  • Mappings - JSON to field mappings
  • Output Array - If the string contains multiple JSON records use this to allow outputing all of them
value
Mappings
Output Array
result
"{ "a": "Hello" }"
"a,a,string"
true
{"a": "Hello"}
"{ "a": { "value": "Hello" }, "b" : { "value": "World" } }"
"a.value,a.value,string b.value,b.value,string"
true
{"a.value": "Hello", "b.value": "World"}

MAP_WITH_INDEX

Outputs an index and a value field. Index contains a zero based index and value contains the value in the input field.

Inputs

  • value - The value to convert to a record
value
result
"a", "b", "c"
{"index": 0, "value": "a"}, {"index": 1, "value": "b"}, {"index": 2, "value": "c"}

QUERY_STRING_TO_RECORD

Extracts data from query string.

Properties

  • Mappings - Field names

TO_ARRAY

Outputs the values from the inputs as an array.
inputs
result
["a", "c"], ["b"]
"a", "c", "b"

ZIP

Last modified 8mo ago