cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Scobie
Level: Powered On

Update context based on Listbox Select

Hello,

 

Can I update a contex variable based on a value selected in a listbox?  I am having a little trouble since the I have formatted the items in the list box.

 

Thanks for your help,

Scobie

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Update context based on Listbox Select

Hi @Scobie,

 

As suggested by @Drrickryp, could you please share the solution that you have found?

 

Basically the Variable could be updated with two function:

UpdateContext()

and 

set()

for Galbal variable

 

For ListBox control, we could get its value by ListBox.Selected, and for specific field, it should be: ListBox.Selected.FieldName

 

and if Multiple selection has enabled, the value then is stored in 

ListBox.SelectedItems

 

So to change Variable value with the ListBox selected value, the formula should be:

UpdateContext({VariableName:ListBox1.Selected})

or

UpdateContext({VariableName:ListBox1.Selected.FieldName})

for the Set() function, it should be:

Set(VariableName, ListBox1.Selected)

Or

Set(VariableName, ListBox1.Selected.FieldName)

For Multiple items, switch the ListBox1.Selected to ListBox1.SelectedItems.

 

Regards,

Michael

Community Support Team _ Michael Shao
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

5 REPLIES 5
Scobie
Level: Powered On

Re: Update context based on Listbox Select

I was able to solve the problem I was having. Can anyone tell me how I can delete this post.

Super User
Super User

Re: Update context based on Listbox Select

 
Super User
Super User

Re: Update context based on Listbox Select

Could you share your solution with us instead of deleting the post?
Community Support Team
Community Support Team

Re: Update context based on Listbox Select

Hi @Scobie,

 

As suggested by @Drrickryp, could you please share the solution that you have found?

 

Basically the Variable could be updated with two function:

UpdateContext()

and 

set()

for Galbal variable

 

For ListBox control, we could get its value by ListBox.Selected, and for specific field, it should be: ListBox.Selected.FieldName

 

and if Multiple selection has enabled, the value then is stored in 

ListBox.SelectedItems

 

So to change Variable value with the ListBox selected value, the formula should be:

UpdateContext({VariableName:ListBox1.Selected})

or

UpdateContext({VariableName:ListBox1.Selected.FieldName})

for the Set() function, it should be:

Set(VariableName, ListBox1.Selected)

Or

Set(VariableName, ListBox1.Selected.FieldName)

For Multiple items, switch the ListBox1.Selected to ListBox1.SelectedItems.

 

Regards,

Michael

Community Support Team _ Michael Shao
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

Scobie
Level: Powered On

Re: Update context based on Listbox Select

Hello @v-micsh-msft,

 

Yes I was able to use:

UpdateContext({VariableName:ListBox1.Selected.FieldName})

 

But I was having trouble getting that to work with how the ListBox sets up its items from the help I got from dinusc in this question I asked:

https://powerusers.microsoft.com/t5/General-Discussion/Formatting-a-Listbox/m-p/147763/highlight/tru...

 

At first having the .singleColumn at the end of the items property gave me problems. But by changing it around abit I got it to work. 

 

It is a little hard to explain so I thought it would be easier to delete the post.

 

Hopefully that helps, 

Scobie

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (3,926)