Skip to main content

Notifications

Community site session details

Community site session details

Session Id : nSLXkX/PBEUVgfWCNCfS9c
Power Apps - Building Power Apps
Suggested answer

Evaluate choice column/ option set using Fx expression in dataverse Formula column

Like (0) ShareShare
ReportReport
Posted on 5 Feb 2023 16:15:28 by 6

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!

  • Suggested answer
    Richard Mamabolo Profile Picture
    2 on 11 Dec 2024 at 05:28:12
    Evaluate choice column/ option set using Fx expression in dataverse Formula column
    Syntax should look like: @FoodType = [@FoodType].'Fruit'
     
    In order to achieve this perform the following actions:
    1. In the Fx Formula field, type out the optionset name
    2. Type out the equals sign
    3. Type out the optionset name followed by Ctrl + Spacebar (this will display the [@FoodType] option)
    4. Add a period after [@FoodType] like so: [@FoodType]. (This will show all the optionset names associated with the option set i.e Fruits, Fruits &Veggies and Veggies)
    5. Select the relevant one. Done.
     
  • Suggested answer
    ankit_singhal Profile Picture
    481 Super User 2025 Season 1 on 04 Oct 2024 at 07:41:17
    Evaluate choice column/ option set using Fx expression in dataverse Formula column
    Please check below blog
    https://www.matthewdevaney.com/25-power-apps-if-function-examples/#IF-Choice-Column-Value-Equals

    Note: Mark verified, if it useful for you 
  • Suggested answer
    CU04100730-0 Profile Picture
    2 on 04 Oct 2024 at 07:33:34
    Evaluate choice column/ option set using Fx expression in dataverse Formula column

    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

  • sryzm Profile Picture
    6 on 16 Feb 2023 at 16:18:27
    Re: Evaluate choice column/ option set using Fx expression in dataverse Formula column

    Thanks. I hope this capability is on the roadmap.

  • v-liwei-msft Profile Picture
    on 06 Feb 2023 at 03:33:43
    Re: Evaluate choice column/ option set using Fx expression in dataverse Formula column

    Hi @yozu 

     

    Unfortunately, this preview column doesn't support this data type now.

    vliweimsft_0-1675654297372.png

     

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard
Loading started