web
You’re offline. This is a read only version of the page.
close
Skip to main content
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

I have the same question (0)
  • 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
    235,928 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
    235,928 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
    235,928 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

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

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 785 User Group Leader

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 626 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 621 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans