Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

NoYes Enum gets an empty value

(0) ShareShare
ReportReport
Posted on by 15

Hello people, 

I have a field in a table which extends EDT NoYesId (which extends Enum NoYes). 

I have a form with some records of this table and the tick is present in the corresponding field checkbox. 

When I run through these records using x++ and showed the value of the field in the infolog, it gave me just a blank result. 

When I looked directly in SQL database, I found the value of 255. 

Somehow, as I understand, the maximal SQL datatype tinyint value has been assigned. 

Any ideas what could be the reason of it? 

Thanks

  • edgcibu Profile Picture
    15 on at
    RE: NoYes Enum gets an empty value

    I found the wrong assignment when importing the enum value from .csv file, from the wrong column. str2enum function is used and when tries to convert unrelated string, I got blank in AX. I think will do some check here, either it is 1 or put 0 otherwise.

    thanks for your time

  • Martin Dráb Profile Picture
    233,573 Most Valuable Professional on at
    RE: NoYes Enum gets an empty value

    I've seen a case where developers were intentionally setting an enum value to 255 to get something like a null value (neither Yes or No; an unselected value). But it's not good design.

  • edgcibu Profile Picture
    15 on at
    RE: NoYes Enum gets an empty value

    I agree, therefore the question was what is the possible reason of getting such corrupted data.

    I will search for the field assignment, maybe something is wrong there.

  • Martin Dráb Profile Picture
    233,573 Most Valuable Professional on at
    RE: NoYes Enum gets an empty value

    No, you confuse enums with the underlaying type (integer). The only valid values of an enum are values of its elements (0 and 1 in this case) That the numeric field stored in the database can have other values is true, but they're not valid values of that enum. It's technically possible to set invalid value, but you can't expect the system to work with such corrupted data.

  • Blue Wang Profile Picture
    on at
    RE: NoYes Enum gets an empty value

    HI Edgcibu,

    Are you getting the value through code?

    Maybe this will help:

    community.dynamics.com/.../enum-noyes-type-has-wrong-value

  • edgcibu Profile Picture
    15 on at
    RE: NoYes Enum gets an empty value

    Isn't it that every enum can get up to 256 values what corresponds to sql tinyint datatype (even if it is system enum NoYes)? and we just define in Ax how many of them to use

  • Martin Dráb Profile Picture
    233,573 Most Valuable Professional on at
    RE: NoYes Enum gets an empty value

    I don't know how you got into this situation, but your database contains invalid data. The valid values are 0 (No) and 1 (Yes); 255 doesn't belong to this enum.

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 Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 372 Most Valuable Professional

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 291

#3
Saalim Ansari Profile Picture

Saalim Ansari 209

Overall leaderboard

Product updates

Dynamics 365 release plans