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
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).
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!
Solved! Go to Solution.
I found this to fix my problem:
Set(var, LookUp(Choices('Collumn(DB)'),Value = 'Collumn (DB)'.'choiceName'))
Thank you for time @WarrenBelz
Hi @RealMABN ,
You have not provided the Items of the Combo Box, however the DefaultSelectedItems need to reflect that it contains a Table and for example if the output was MyComboName.Selected.Value and the column MyField was a Text column, then the DefaultSelectedItems would be
{Value: ThisItem.MyField}
If MyField was a Choice field then
{Value: ThisItem.MyField.Value}
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Hi WarrenBelz,
Thank you for your answer,
I'm a little unsure about your solution, becuase how do i connect the function from my button to the combo box?
I have also this to add:
Normally would the combo box have [Parent.Default] in DefaultSelectedItems and in items Choices(DB)
I also just checked the collumn and it is a YES/NO data type because it only has two options.
Thanks again
You still have not provided the Items of the Combo Box - or is it Choices(Db) - that and the fields and type (and name) you are writing to determines the DefaultSelectedItems - can you please provide both of these.
@WarrenBelz
The Items for the combo box is just Choices(DB) where DB is the table name
Collumn setting for the combo box:
Type = Custom
Data type = Yes/NO
Required: Yes
I made a mistake when i choose the data type for the collumn who has the combo box and ended up with the default YES/NO which i just changed to fit my two options. I dont know if that changes anything 🙂
Thanks
Hi @RealMABN ,
That is confusing - your Items should refer to a column, not a table and Choices needs to be a Choice or Lookup field.
Choices(ListName.FieldsName)
and why are you writing a combo box back to a Boolean (Yes/No) field with a Text value? I honestly have no idea what you are trying to achieve,
Hi @WarrenBelz
Sorry but I'm new to powerapps and dataverse table, i just want to create an app where I can change the value of a input(fx combo box) which can represent the collumn in a form. The data can then be submitted to a table in a dataverse. I have setup all the connection and collumns I'm just not sure how which input would be the best for change a two value option with a button and how to do it right. 🙂
Thanks again
That really does not clarify it any better. I am not a Dataverse user (it is good to state your data souce in your post), but a combo box would normally require a Choice (option set in Dataverse) field to interact with.
Hi @WarrenBelz
Sorry that i didnt calify enough that i was using Dataverse.
Do you think the code would work if i changed the choice option from a combo box to a drop down box?
And is there something that i need to be aware of when i change a input in a form like this? 🙂
Thanks again
I found this to fix my problem:
Set(var, LookUp(Choices('Collumn(DB)'),Value = 'Collumn (DB)'.'choiceName'))
Thank you for time @WarrenBelz
User | Count |
---|---|
252 | |
126 | |
104 | |
50 | |
49 |