web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / If/Then Statement usin...
Power Apps
Answered

If/Then Statement using Dataverse Yes/No Choice Column shows formula not in scope.

(0) ShareShare
ReportReport
Posted on by 81

With a form data card I am trying to write a simple if/then statement to change the color of the card based on the value of a (Yes/No) Choice field (In_Spec) in the record.

 

Within the fill property:

If(ThisItem.In_Spec,

RGBA(0,255,0,.5),

RGBA(255,0,0,.5))

 

The error I get is: 

ce_PowerPlay_0-1697552528649.png

Can someone explain the correct way to use a Dataverse table (yes/no) choice column in a record so it can be used to evaluate an If/Then statement in a power apps canvas app.

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    Anchov Profile Picture
    1,986 on at

    To evaluate a Yes/No column in Dataverse, you need to specify the Yes and No values by selecting the appropriate options from the "Choice Set." This is typically in the format of '[Name of Yes/No Column] ([Name of Table])].[Selected Choice]'. Here's an example:

    Anchov_0-1697558697203.png

     

     

    If(ThisItem.Active = 'Active (Dog Breeds and Characteristics)'.Yes, "Active", Blank())

     

    For you it will be something like:

     

    If(ThisItem.In_Spec = 'In_Spec (yourtablename)'.Yes,
    RGBA(0,255,0,.5),
    RGBA(255,0,0,.5))

     

    Hint: The intellisense in the formula bar should help you fill in and validate the choice set by starting to type your column name.

    Anchov_1-1697559162662.png

     


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

    Cheers!
    Rick Hurt

  • CE-16101943-0 Profile Picture
    81 on at

    You are correct that works.  When working with Forms & Datacards inside Power Apps there is one more step that I found is necessary.  The data card for the choice column must be included in the form.  You can make it invisible, but it has to be there.  This may be a bug, but the logic @Anchov explained will only work if the evaluated choice column's datacard is included in the form.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 337 Most Valuable Professional

#2
11manish Profile Picture

11manish 173

#3
Valantis Profile Picture

Valantis 86

Last 30 days Overall leaderboard