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 / 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:
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,975 Super User 2026 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 232 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard