cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jcregg
Advocate II
Advocate II

Update variable based on combo box selection.

I have a flow which parses some json containing an array of values. Two of the values in each items are then passed back to my app inside a collection. E.g.

Builds,
{
ID: "1",
Name "Test"
},
{
ID: "2",
Name: "Test2"
}

I have passed each name to a combo box but I want to update a variable called ID to the corresponding value when the combo box is changed. The end result is so I can trigger a different flow and pass the ID to it based on the name which has been selected. 

 

Any help or alternative ideas welcome, thanks. 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

@jcregg ,

 

I propose you another approach starting with the flow. Please take a look of my flow:

 

Capture.PNG

This will respond to powerapps with only one string were the records are separated by ";" and the values inside records by ",".

So having this, all we have to do is to create our collection usable in comboBox. My formula is s a little bit scary, but i'm sure that you'll get it:

 

ClearCollect(builds,AddColumns(Split(returnAnArray.Run().text,";"),"buildid",Left(Result,Find(",",Result)-1),"buildnumber",Right(Result,Len(Result)-Find(",",Result))))

View solution in original post

4 REPLIES 4
gabibalaban
Super User II
Super User II

Hi @jcregg ,

You can use the OnChange property of the comboBox and update the context variable there:

UpdateContext(ID:ComboBox.Selected.ID)

or if you don't need the context variable in other places you can call the second flow refering to the ID using directly: ComboBox.Selected.ID

MySecondFlow(ComboBox.Selected.ID)

 

Hope it helps !

Thanks for your help @gabibalaban 

 

I think I may have jumped ahead a step and I am still having some issues getting the collection correct. (You can probably tell I am new to powerapps!)

 

My Flow is returning two values as below:

 

Flow Settings

jcregg_0-1606663813355.png

Example Output:

{
"buildid": "1;2",
"buildnumber": "test_1;test_2;
}

 

I then have a combo box which displays the buildnumbers, which I have done using the Split function. 

I now want to set a variable var_buildID to the corresponding buildid, which I think you have explained above but I am still doing something wrong. 

 

Thanks for your help. 

@jcregg ,

 

I propose you another approach starting with the flow. Please take a look of my flow:

 

Capture.PNG

This will respond to powerapps with only one string were the records are separated by ";" and the values inside records by ",".

So having this, all we have to do is to create our collection usable in comboBox. My formula is s a little bit scary, but i'm sure that you'll get it:

 

ClearCollect(builds,AddColumns(Split(returnAnArray.Run().text,";"),"buildid",Left(Result,Find(",",Result)-1),"buildnumber",Right(Result,Len(Result)-Find(",",Result))))

View solution in original post

jcregg
Advocate II
Advocate II

@gabibalaban Thanks again - that has solved it.

 

I updated my flow and then I was initially just entering the source for my combo box as the one column, but I changed it to the whole collection with just the display of one column. Everything then started to work.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,592)