Structural functions
This page goes over the structural functions in Upsolver.
FROM_KEY_VALUE
FROM_KEY_VALUE
Maps a list of key values to a record with fields for each key.
Inputs
key
value
Properties
Keys
Example
Input
SQL
Result
GET_RANGE
GET_RANGE
Returns range of numbers between start and end (inclusive).
Inputs
first
last
ITEM_INDEX
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
JSON_PATH
Extracts data from JSON objects.
Inputs
JSON - A String that contains JSON Document
Properties
Path - JSON Path Expression
JSON_TO_RECORD
JSON_TO_RECORD
Extracts data from JSON objects. This only includes any JSON documents from the data source; this function does not work on or include in the result any calculated fields.
This function expects a string formatted according to classic JSON requirements.
See: JSON format
It is recommended that you first validate your string format before applying this function as additional pre-processing may be required to get your data in the correct format.
See the data below for an example.
Properties
Mappings - JSON to field mappings
Output Array - If the string contains multiple JSON records use this to allow outputing all of them
Example
Notice that this data is not in standard JSON format as it uses single quotes '
instead of double quotes "
.
Additionally, the boolean values are formatted as True
and False
; however, this function only parses lower case boolean values.
As a result, in order to correctly parse our original string, we first convert it to a proper JSON format before using using the JSON_TO_RECORD
function to parse it.
If you have multiple records concatenated into one string as shown in the sample data, it is recommended to use Upsolver's JSON output format rather than the tabular output format. This allows the output to have an array column structure.
MAP_WITH_INDEX
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
The example below illustrates the usage of the function and also how to reference the array of values created as a result:
QUERY_STRING_TO_RECORD
QUERY_STRING_TO_RECORD
Extracts data from query string.
Properties
Mappings - Field names
RECORD_TO_JSON
RECORD_TO_JSON
Converts the record containing the field to a JSON string. This only includes any JSON documents from the data source; this function does not work on or include in the result any calculated fields.
Note that the preview functionality only shows fields in the JSON that were output directly in other fields. However, when you run the output, it will include the full JSON.
Example
Input
SQL
Result
TO_ARRAY
TO_ARRAY
Outputs the values from the inputs as an array.
ZIP
ZIP
See: ZIP
Last updated