Hi all,
I'm expecting this is a really easy solve, but I've wasted quite a lot of time on it now and can't spot the answer.
I have three Comboboxes. I want to compare the selection in the first combobox to the second and the third. If the selection in the FIRST matches the selection in the SECOND OR the THIRD, return true.
I'm finding that the expression is evaluating correctly for the comparison between the first and second combobox but it pays no attention to whatever value is in the third. IE if the same selection is made in combobox 1 and combobox 3, the result is false whereas it should be true.
I am using the expression below:
(The comboboxes are named: 'cmb-3-FirstChoice', etc. The selectable option list for each combobox is supplied from 'AppDataType1').
If(
'cmb-3-FirstChoice'.Selected.AppDataType1 = 'cmb-3-SecondChoice'.Selected.AppDataType1 Or 'cmb-3-ThirdChoice'.Selected.AppDataType1,
UpdateContext({cmbstate: true})
I have tried changing 'Selected.AppDataType1' to .SelectedItems but meet with the error that tables cannot be compared.
Any help much appreciated! Thank you!
Many thanks @LaurensM and @BCBuizer for the really helpful and fast responses!
To make it easy for anyone reading this thread in the future, essentially the issue was that in the 'Or' part of the If statement, the test condition had to be entered again (after the 'Or'), like this:
If(ItemtoTest = 1 Or ItemToTest = 2, outcome if true)
(Please note that both of the replies received to this thread are accurate and valid. I marked @LaurensM as the Solution as first to reply but @BCBuizer 's solution is also great and easy to understand)
Hi @pp365,
You can use the condition as the input of your variable - the condition will return true or false:
UpdateContext(
{
cmbstate: 'cmb-3-FirstChoice'.Selected.AppDataType1 = 'cmb-3-SecondChoice'.Selected.AppDataType1 || 'cmb-3-FirstChoice'.Selected.AppDataType1 = 'cmb-3-ThirdChoice'.Selected.AppDataType1
}
)
If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.
Thanks!
Hi @pp365 ,
Here you go:
If(
'cmb-3-FirstChoice'.Selected.AppDataType1 = 'cmb-3-SecondChoice'.Selected.AppDataType1 Or
'cmb-3-FirstChoice'.Selected.AppDataType1 = 'cmb-3-ThirdChoice'.Selected.AppDataType1,
UpdateContext({cmbstate: true})
)
WarrenBelz
146,645
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional