Get property value from object array returned by excel script
Hello,
I have the following flow piece:
The block Run script (Get data from the Customer Workbook) is returning an array of objects:
*function main(workbook: ExcelScript.Workbook): WorksheetData[]
interface WorksheetData {
customer: string;
customerid: string;
nrows: number;
data: string[][];
}*
The issues I'm experimenting is I haven't been able to find a way to get the nrows property value of the 1st array element, it is required to increment a variable in the loop.
If I include directly the property, I'm getting a for each block:
I have tried with different options in an expression, but no luck, e.g.:
outputs('Run_script_(Get_data_from_the_Customer_Workbook)')?['body/result'][0].nrows
first(outputs('Run_script_(Get_data_from_the_Customer_Workbook)')?['body/result']).nrows
outputs('Run_script_(Get_data_from_the_Customer_Workbook)')?['body/result'])?['nrows']
Any hint will be welcome.
Here an example of the object (json) returned:
{
"result": [
{
"customer": "VW",
"customerid": "VWID",
"nrows": 4,
"data": [
[
"VW BRANCH ONE",
"PL",
"Travel",
"VWBRANCH01"
],
[
"VW BRANCH TWO",
"DE",
"Travel",
"VWBRANCH02"
],
[
"VW BRANCH THREE",
"DE",
"Expense",
"VWBRANCH03"
],
[
"VW BRANCH FOUR",
"MX",
"Travel",
"VWBRANCH04"
]
]
}
],
"logs": [
"[2021-11-30T22:03:32.7650Z] [{\"customer\":\"VW\",\"customerid\":\"VWID\",\"nrows\":4,\"data\":[[\"VW BRANCH ONE\",\"PL\",\"Travel\",\"VWBRANCH01\"],[\"VW BRANCH TWO\",\"DE\",\"Travel\",\"VWBRANCH02\"],[\"VW BRANCH THREE\",\"DE\",\"Expense\",\"VWBRANCH03\"],[\"VW BRANCH FOUR\",\"MX\",\"Travel\",\"VWBRANCH04\"]]}]"
]
}