cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RealMABN
Helper II
Helper II

Trying to set combo box value with the press of a button

Hi all,

I'm new to powerapps and dataverse, and i have run into a problem that i feel like i have used too much time on now.
In my powerapp I'm trying to use the SET and LOOKUP function to set a value in a combo box via a press of a button. The Combo box is connected to a dataverse form. The dataverse table is connected in the powerapp.



The thing i tried was:
Button(OnSelect): Set(Var,LookUp(DB, columnName = "Bla Bla"))
Combo Box(DefaultSelectedItems): Var
But here i get the "These types cant be compared: DB, text"


Then i tried this function:
Button(OnSelect): Set(Var,LookUp(DB,"Bla Bla" in columnName))
Combo Box(DefaultSelectedItems): Var

Here is a little info box:
Var = Just a variable
DB = Table name
columnName = Table column name
"Bla Bla" = Combo box option

Let me know if anything is unclear - Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @RealMABN ,

 

So it is a Choice column (Option Set) of Dataverse. I made a test for your reference:

vjefferni_2-1651632088783.png

vjefferni_3-1651632100698.png

Set(var, LookUp(Choices('Employment (UserDBS)'),Value = 'Employment (UserDBS)'.'White Collar'))

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

5 REPLIES 5
RealMABN
Helper II
Helper II

I totally forgot to add the error i got from the 2nd function.

But when i use the function: Button(OnSelect): Set(Var,LookUp(DB,"Bla Bla" in columnName)) I get the runtime error: Server Response: DB failed: No function signature for the function with name 'contains' matches the specified arguments. The function signatures considered are: contains(Edm.String Nullable=true. Edm.String Nullable=true).

v-jefferni
Community Support
Community Support

Hi @RealMABN ,

 

Could you please tell the Items of the Combo box? Since the selected items should be one or more records that exist in the table, on your end you need to make sure the Items property is the DB Dataverse table as well.

 

I made a simple test for your reference:

vjefferni_1-1651225416011.png

vjefferni_0-1651225404390.png

 

If the Items and the Set function share different data sources, you need use another LookUp function in DefaultSelectedItems to get the corresponding record.

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi @v-jefferni,
Thank you for your answer 🙂
I have added both items to the datastore collumn and then i tried this:
Employment/Combo box:

RealMABN_3-1651231786421.png
I tried with just userDBS (which is the table name), but without any success.



Button:

RealMABN_2-1651231696819.png
I get this "error" but could it be that i need to use the Text() function?



When i select an item from the combo box then i can see both options

 

RealMABN_0-1651231089145.png

 



Hi @RealMABN ,

 

So it is a Choice column (Option Set) of Dataverse. I made a test for your reference:

vjefferni_2-1651632088783.png

vjefferni_3-1651632100698.png

Set(var, LookUp(Choices('Employment (UserDBS)'),Value = 'Employment (UserDBS)'.'White Collar'))

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi @v-jefferni,

Thank you so much. This helps alot! 🙂

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,682)