cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JimTurner
Frequent Visitor

How to Retrieve Data from Array with no named fields

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

1 ACCEPTED SOLUTION

Accepted Solutions
v-yamao-msft
Community Support
Community Support

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)

1.PNG2.PNG

Hope it could be a reference for you.

Reference material:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#s...

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yamao-msft
Community Support
Community Support

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)

1.PNG2.PNG

Hope it could be a reference for you.

Reference material:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#s...

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

JimTurner
Frequent Visitor

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

GabrielStJohn
Microsoft
Microsoft

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

- Gabriel
Community Manager
Power Automate | Power Virtual Agents
Super User Program Manager



Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (1,121)