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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Problem with 'Choice' ...
Power Apps
Suggested Answer

Problem with 'Choice' data type in Dataverse Table

(1) ShareShare
ReportReport
Posted on by 37
I imported to Dataverse an Excel, but, by mistake, assigned as 'choice' type a field that originally had integers.
 
When I get a 'SelectedRecord' record with LookUp, I have a lot of problems with this field. When I compare with an integer value ir returns FALSE
 
Set(myBoolean,SelectedRecord.Section=1)
 
myBoolean is ALLWAYS false, but the actual value of this field is 1 (as 'choice'). Not 1 as integer, nor 1 as string. How can I compare?
 
Thanks!
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,452 Super User 2025 Season 2 on at
    Hi
     
    If you imported incorrectly, you need to wipe the data and start over otherwise you are writing code to try to overcome a bad move with the data, code shouldn't be used for that, its not sustainable.
     
    You would need to do something like this
     
    Assuming that .Section is actually a Choice, is like my below
    My table has a Column called MyChoice2 as a choice, i want to compare the literall choice '1' (which is a string) value
     
    [@'MyChoice2 (TableAS)'].'1'
     
    so this is the format you use, where after you type the . (period) you will see your choices to select from. So you can compare
    Again though, if its NOT a choice Section then it won't work unless you convert the value to a text string.
     
     
  • Suggested answer
    Ammar Zaied Profile Picture
    97 on at

    When you accidentally set a field as a 'choice' in Dataverse, it stores the value as an object with both a label (text) and an underlying integer value. Because of this, when you compare a 'choice' field directly with an integer or string, the comparison will fail.

    To compare the underlying value of a 'choice' field, you need to extract the value property of the choice field before comparing it with an integer.

    try this:

    Set(myBoolean, SelectedRecord.Section.Value = 1)
    
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard