iPaaS Flows: Indexing a funky property
Hello,
As some background, I'm using the Google Sheets connector to go ahead and grab some data from Google Drive, selecting some cells in a spreadsheet.
The connector returns a 'values' field, which, in my specific situation (I'm simply selecting a single row) returns a matrix/2D array with one row, and several columns.
When attempting to index this 'values' property in iPaaS, I simply get 'null', despite the data clearly being there–I even tried row 0, column 0, but got the same thing.
Leaving the row and column indices blank returns the entire matrix, which means the data is indeed there and accessible within the 'values' field returned by the connector.
I went ahead and tried to index it in JavaScript instead, thinking I must be making some stupid mistake, but it worked in JS perfectly fine; row 0, column 0→20 always gave the expected value.
So, I'm lost as to what I must be doing wrong in iPaaS to index this thing? Why isn't it as simple as providing a row and a column?
Thanks.
Answer (1)
Good afternoon Emil,
I think we worked through this on a call - but I apologize if not. The indexing in iPaaS starts at 1, whereas indexing in Python and Javascript starts at 0. You were most likely unable to index due to that.
-Matt
{
"type": "Value",
"name": "MY_FIELD_NAME",
"expression": {
"type": "Identifier",
"value": "$ds$12['Data'][][]",
"indexers": [
{
"type": "Identifier",
"value": "$ds$21"
},
{
"type": "NumericLiteral",
"value": 7
}
]
}
},
when referencing things through a Script, that "NumericLiteral" in this case would be 6 in the script, so eg.
var myField = $ds$12['Data'][$ds$21][6]; - Christopher Myers Tue 1/30/24 4:28 PM