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

Update value in a combo box

I am new to Power Apps.  I have no programming experience but a lot of Excel experience.  I am trying to build my first app from a list in SharePoint (it's an in/out board).  I would like to add a button to my power app that changes the value in a combo box. Ultimately I want it to change several values with one button click but this is my first step.

 

I have been trying to get something like this to work with OnSelect:
UpdateContext( {DataCardKey1:LookUp ( Choices([@'In Out Board'].Status), Value = "At Lunch") } )

 

But it's not working.  Am I in the right direction, can anyone make a suggestion of how to make this work?  Seems like it should be simple.  Thanks


truarchs_0-1595512659246.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @truarchs ,

Do you want to change a combo box's selected value?
Is Status choice type?

Please notice that there's only two ways to change the selected value of a combo box:

1)select value manually

2)reset combo box to its defaultselecteditem

Since you want to change the selected item by clicking a button, so the second solution is more suitable for you.

I've made a similar test for you:

1)combo box's Items:

Choices([@'In Out Board'].Status)

combo box's Items DefaultSelectedItems:

If(var="At Lunch",
   LookUp ( Choices([@'In Out Board'].Status), Value = "At Lunch"),
   ThisItem.Status
)

2)button's OnSelect:

Set(var,"At Lunch");Reset(DataCardKey1)

3)this datacard's Update:

DataCardKey1.Selected

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
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

4 REPLIES 4
eka24
Super User
Super User

Can you explain further. Do you want to send the information in the combobox into the Sharepointlist

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

truarchs
Frequent Visitor

Hi, thank you for looking at this.

 

Ultimately I would like to make a button that changes all the field values so someone could click a button and it would sign them out of the office for an hour.  My first step is to simply make a button that would change one value, the "Status", from it's present value  "Not at work" to "At Lunch".  I thought I could just change the values in this form, and then save the form to update the SharePoint list.  I'm not sure if that's the best approach.

v-yutliu-msft
Community Support
Community Support

Hi @truarchs ,

Do you want to change a combo box's selected value?
Is Status choice type?

Please notice that there's only two ways to change the selected value of a combo box:

1)select value manually

2)reset combo box to its defaultselecteditem

Since you want to change the selected item by clicking a button, so the second solution is more suitable for you.

I've made a similar test for you:

1)combo box's Items:

Choices([@'In Out Board'].Status)

combo box's Items DefaultSelectedItems:

If(var="At Lunch",
   LookUp ( Choices([@'In Out Board'].Status), Value = "At Lunch"),
   ThisItem.Status
)

2)button's OnSelect:

Set(var,"At Lunch");Reset(DataCardKey1)

3)this datacard's Update:

DataCardKey1.Selected

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
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

Thank you so much Phoebe!

 

You not only came up with a solution, but also helped me understand how it works.  This is a huge help for me.  The only thing I needed to do differently than what you suggested is "DataCardKey1" needed to be "DataCardValue1".  Other than that, it worked exactly as you stated.

 

Genius!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Top Solution Authors
Top Kudoed Authors
Users online (964)