无法通过 UI 正确设置 Dynamics AX 强制枚举字段
谁能向我解释以下行为?
当 AX 表中的字段类型设置为 Enum 时,您可以选择任何 Enum 值作为该字段的值。
但是,如果您将该字段设为必填,则无法再通过用户界面选择列表中的第一个 Enum 值。
显然,这可以通过不将该字段设为强制字段来解决。我正在寻找对这种奇怪行为的解释。
Can anyone explain the following behaviour to me?
When a field type in an AX Table is set to an Enum, you can select any of the Enum values as a value for the field.
But if you make the field Mandatory, you can no longer select the first Enum value in the list through the user interface.
Obviously this can be worked around by not making the field Mandatory. I am looking for an explanation of this bizarre behaviour.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
AX 没有空值概念。相反,根据定义,以下值被视为“未输入”:
对于新的基本枚举,make空白零枚举值(按照约定将其命名为 None)。这将使该枚举类型可以使用强制字段。
另请查看:标记必填字段在表单上,如果未填写有效值
AX does not have a null value concept. Instead the following values are considered "not entered" by defintion:
For new base enums make a blank zero enum value (by convention name it None). This will make the use of mandatory fields possible for this enum type.
Also have a look on this: Mark mandatory fields on form, if not filled with valid value
您是说“如果您将该字段设置为必填字段,则无法再通过用户界面选择列表中的第一个枚举值” - 这正是 Mandatory 属性对枚举的作用:防止您使用零值。例如,如果您将
NoYesId
设为强制,您将只能输入Yes
,因为No
将不再被允许 - 为什么您需要它那么形式呢?另请注意,从用户的角度来看,不一定清楚什么枚举值为零,因此如果它不按其工作方式工作,那么理解当枚举是强制性的时不允许什么值可能会很棘手。
You're saying "if you make the field Mandatory, you can no longer select the first Enum value in the list through the user interface" - this is exactly what the Mandatory property does for enums: prevents you from using a zero value. E.g. if you make
NoYesId
mandatory you'll be able to enter onlyYes
becauseNo
would no longer be allowed - why would you need it on the form then?Please also note that from a user perspective it isn't necessarily clear what enum value is zero, so if it didn't work the way it works, understanding what value is not allowed when the enum is mandatory could be tricky.