Hi I have an array returned from HTTP call which looks as follows
[
["2013 TESCO","2013","Swindon Abbey Mds Exp","Unit 4 Village Centre","Elstree Way","Abbey Meads","SN25 4YX","TESCO","Template Form",null,null],
["2346 TESCO","2346","Gloucester Mead Rd Exp","Unit 1","Mead Road","Abbeymead","GL4 5GL","TESCO","Template Form",null,null],
["2015 TESCO","2015","Aberdare","Depot Road",null,"Aberdare","CF44 8DL","TESCO","Template Form",null,null],
["3729 TESCO","3729","Aberdare Pfs","Depot Road",null,"Aberdare","CF44 8DL","TESCO","Template Form",null,null],
["2001 TESCO","2001","Pittodrie Express","472 Kings Street",null,"Aberdeen","AB24 3DF","TESCO","Template Form",null,null],
["2007 TESCO","2007","Aberdeen Extra","Laurel Drive","Danestone","Aberdeen","AB22 8HB","TESCO","Template Form",null,null],
["3910 TESCO","3910","Aberdeen Extra Pfs","Laurel Drive","Danestone","Aberdeen","AB22 8HB","TESCO","Template Form",null,null],
["5512 TESCO","5512","Dyce Aberdeen Exp","35 Victoria Street","Dyce","Aberdeen","AB21 0ET","TESCO","Template Form",null,null],
["5639 TESCO","5639","Aberdeen Grt West Exp","571","Great Western Road","Aberdeen","AB10 6PA","TESCO","Template Form",null,null],["5689 TESCO","5689","Aberdeen Nrt Dees Exp","393 North Deeside Roa","Cults","Aberdeen","AB15 9SX","TESCO","Template Form",null,null]
]
I am trying to cycle through the array to see if the first field contains specfic text, but I am struggling to be able to reference the first , second items in an array etc without a field name
i.e. does 5639 TESCO exist in the array
I believe it would be a selection of compose or select but I am fumbling around in the dark with the syntax
Can anyone help
Solved! Go to Solution.
Hi @JimTurner,
To get the first item in an array, please take the following flow for a reference.
In the following flow, I sue the array you provided for testing.
First, initialize variable, set the name as Test, type as String.
Add Compose action, input the array you provided.
Set variable, select compose output for the Value field.
Then add a Compose2, use the following code:
split(variables('Test'),']')
Then compose3, use the following code to get the first item:
skip(first(outputs('Compose_2')),3)
Hope it could be a reference for you.
Reference material:
Best regards,
Mabel Mao
Hi @JimTurner,
To get the first item in an array, please take the following flow for a reference.
In the following flow, I sue the array you provided for testing.
First, initialize variable, set the name as Test, type as String.
Add Compose action, input the array you provided.
Set variable, select compose output for the Value field.
Then add a Compose2, use the following code:
split(variables('Test'),']')
Then compose3, use the following code to get the first item:
skip(first(outputs('Compose_2')),3)
Hope it could be a reference for you.
Reference material:
Best regards,
Mabel Mao
Hi Mabel
Many thanks for your guidance
and what you provided worked , However I tweaked
skip(first(outputs('Compose_2')),3)
to this
first(skip(outputs('Compose_2'),3))
so I could chnage the array item being found..
Its sets me off in the correct direction
Hey, @JimTurner!
Thank you for posting to the Flow Community Forum! It appears you have found a solution to your issue! If you feel as though your issue has been solved and you are satisfied with one of the previous replies, please click "Accept as Solution" on the reply that contains the solution so that this thread will be marked for other users to easily identify!
Thank you for being an active member of the Flow Community!
-Gabriel
Microsoft Flow Community Manager
User | Count |
---|---|
93 | |
46 | |
20 | |
20 | |
16 |
User | Count |
---|---|
134 | |
56 | |
44 | |
36 | |
26 |