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:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,960 Moderator 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 529 Most Valuable Professional

#2
Haque Profile Picture

Haque 230

#3
Kalathiya Profile Picture

Kalathiya 217 Super User 2026 Season 1

Last 30 days Overall leaderboard