1. Docs
  2. Formulas
  3. Functions

COMBINE_COLUMNS_AND_ROWS

Combines labeled columnar data into a list of objects, using each column name as a key exactly as written. Useful for processing data returned from APIs like Snowflake, Databricks, or Google Sheets.

Categories: Data Parsing/Conversion

Syntax

COMBINE_COLUMNS_AND_ROWS(columns, rows)

Examples

Example 1

Input

1
{
2
"cols": [
3
"Name",
4
"Age"
5
],
6
"rows": [
7
[
8
"Alice",
9
35
10
],
11
[
12
"Bob",
13
51
14
]
15
]
16
}

Formula

COMBINE_COLUMNS_AND_ROWS(cols, rows)

Output

1
[
2
{
3
"Name": "Alice",
4
"Age": 35
5
},
6
{
7
"Name": "Bob",
8
"Age": 51
9
}
10
]

Example 2: Turn a Snowflake SQL API response into one object per row, using MAP to get the column names

Input

1
{
2
"snowflake_response": {
3
"body": {
4
"resultSetMetaData": {
5
"rowType": [
6
{
7
"name": "NAME",
8
"type": "text"
9
},
10
{
11
"name": "AGE",
12
"type": "fixed"
13
}
14
]
15
},
16
"data": [
17
[
18
"Alice",
19
"35"
20
],
21
[
22
"Bob",
23
"51"
24
]
25
]
26
}
27
}
28
}

Formula

COMBINE_COLUMNS_AND_ROWS(MAP(snowflake_response.body.resultSetMetaData.rowType, "name"), snowflake_response.body.data)

Output

1
[
2
{
3
"NAME": "Alice",
4
"AGE": "35"
5
},
6
{
7
"NAME": "Bob",
8
"AGE": "51"
9
}
10
]

Sample actions

Event Transform
Snowflake response
Event Transform
COMBINE_COLUMNS_AND_ROWS

Select an action to inspect

You can also click "Copy actions" and paste them in your Tines story to see how they work.

Was this helpful?