cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mfialek
Helper I
Helper I

Parse Array in PowerApps coming from Flow

Hello,

I am having a hard time parsing an array coming from flow.  I need to separate only the productid form it so I can create a dropdown list.  Please see attached for a sample of how the array comes. 

 
 
 
 
 

Any help is appreciated!

2 ACCEPTED SOLUTIONS

Accepted Solutions

OMG! I feel like an idiot! I am used to looking at results in labels to know what is going on with my data.  I moved it to the drop down already on the screen and it worked!  THANKS! SO MUCH!   my drop down is working great and the response time is ideal.   I will have to deal with them adding a description to that string too. 

I really appreciate your help.  I will mark this a solved. 

View solution in original post

EricLott
Resident Rockstar
Resident Rockstar

No need to feel like an idiot, I recognized the problem because I've done the same thing. Glad it's working now!

---
If this answered your question, please click "Accept Solution". If this helped, please Thumbs Up.

View solution in original post

14 REPLIES 14
EricLott
Resident Rockstar
Resident Rockstar

You can use Match() with regex to solve this. Try this:

First(Match(YourString,"{""ProductID"":""(.+)""}",MatchOptions.Contains).SubMatches).Value

See my example below:

2020-01-09 08_22_23-SQLQuery92.sql - ubpos02_liberty.INVENTORYSCAN (OWENSGROUP_elott (63))_ - Micros.png

For an array, I'll need to know more about the structure and your use case to know how to parse the entire array into a collection of ProductIDs. If the above example helps you enough to get you going, please click "Accept Solution". If this helped, please Thumbs Up.

Thanks for your response.  I tried it but I didn't get any different results.   Please see the attached.  I am triggering the flow from a button after I enter partial text in an input text box.  I am display the results in a text box.   I have a drop down only to also show results.  This is a test screen to make it work before I move it to the main search screen. 

Please see the attachment. 

EricLott
Resident Rockstar
Resident Rockstar

Try this:

Substitute(Substitute(Split(YourArrayString,"""\n"""),"{""ProductID"":""",""),"""}","")

See example below:

2020-01-09 09_15_22-SQLQuery92.sql - ubpos02_liberty.INVENTORYSCAN (OWENSGROUP_elott (63))_ - Micros.png 

I see the productid in the results and they look good! but when I am done writing the formula  I get error "Expected Text value".   In your formula you are using textinput2.text but I have to use the variable I had set up to store the array 

Set(ProductReturn,'PowerApps-Get-Product-Info'.Run(RecordTitle.Text))

so I use:

Substitute(Substitute(Split(ProductReturn.prodid, """\n"""), "{""ProductID"":""",""),"""}","")

 

am I doing this wrong? 

EricLott
Resident Rockstar
Resident Rockstar

Just a guess, but ProductReturn.prodid is probably a Table type. you can check like this:

2020_01_09_09_48_03_Inventory_Tracking_Power_Apps.png

If that's the case, you can use this:

Substitute(Substitute(Split(First(ProductReturn).prodid, """\n"""), "{""ProductID"":""",""),"""}","")

OR

Substitute(Substitute(Split(First(ProductReturn.prodid).prodid, """\n"""), "{""ProductID"":""",""),"""}","")

If that doesn't work, we can try something else.

no both still stay "Expected Text value"

EricLott
Resident Rockstar
Resident Rockstar

Could you screenshot it? Please place your cursor immediately behind ProductReturn.prodid so I can see it's properties.

Here you go

I tried putting in in a collection too but same results. 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,202)