Hi,
Here is my scenario in a model driven app with a Dataverse table.
There is a Choice column in Table A called FoodType. User has the option to pick one of three choices: Fruit, Fruit & Veggies, Veggies from the global choice/optionset called FoodTypeCategoryOptions. The corresponding number values are 1001,1002,1003.
There is second column - a formula column (preview feature) on the same table A named FoodAction, in which I want to implement the following example logic:
If( 'Food Type'= 1001, "F", 'Food Type'= 1002, "FV", 'Food Type'= 1003, "V")
Receiving the following error on the evaluative portion of a simple expression like: If('FoodType'= 1001, "F", "Empty")
Incompatible types for comparison. These types can't be compared :
OptionSetValue(global_cr123_foodtypecategoryoptions), Value.
Note: cr123 is the publisher in this solution.
Need help with the appropriate syntax for extracting and referencing the selected Value and Text values, stored in the FoodType column. I can then use the true/false result in second part of an IF or Switch statement.
It is probably something obvious, but I can't find the right answer in google searches and chatGPT.
thanks in advance!
I have tested these 3 different formulas and they all seem to work. You need to refer to the choice values using the choice display name followed by the value.
Go to your Choices and check the display name. My choice display name is chProductVisibility, my values are Private, Public and Invite.
In my table, I have created a formula to check the value on Product Visibility Column ('Product Visibility')
1st test column created was TestChoicePrivate Column - result returned Yes or No
'Product Visibility' = chProductVisibility.Private
2nd test column created used IF - column name TestChoice
If('Product Visibility' = chProductVisibility.Private, "PR",
If('Product Visibility' = chProductVisibility.Public, "PU",
If('Product Visibility' = chProductVisibility.Invite, "IN", "")
)
)
3rd test column created used SWITCH - column name TestChoiceSwitch
Switch(
'Product Visibility',
chProductVisibility.Invite, "IN",
chProductVisibility.Private, "PR",
chProductVisibility.Public, "PU"
)
I hope this helps!
Melina Louzada
Access Analytic
www.accessanalytic.com.au
Thanks. I hope this capability is on the roadmap.
Hi @yozu
Unfortunately, this preview column doesn't support this data type now.
https://learn.microsoft.com/en-us/power-apps/maker/data-platform/formula-columns#data-types
Hope it saves your time.
You can create a text column and then update the column through PowerApps or Flow.
Best Regards,
Levi
WarrenBelz
146,651
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional