Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Range on integer fields in Axapta/Dynamics Ax

Tags:

axapta

x++

Is there a way, in Axapta/Dynamics Ax, to create an Extended Data Type of type integer which only allows enering values in a specified range (i.e., if the extended data type is meant for storing years, I should be able to set a range like 1900-2100), or do I have to manage the range using X++ code?

And if I need to use X++ code to manage the range, which is the best way to do it?

like image 549
Enrico Detoma Avatar asked Aug 27 '26 12:08

Enrico Detoma


2 Answers

I suggest you use the ''validateField'' of the corresponding table. Search for the method in AOT\Data Dictionay\Tables to see many examples.

like image 139
Jan B. Kjeldsen Avatar answered Aug 30 '26 08:08

Jan B. Kjeldsen


You can can't specify the range on the extended data type itself. If the type is used for a table field, you can add code to the insert and update methods of the table, in order to validate the value whenever the record is updated. This approach could however have a cost in terms of performance.

You can also choose to just add code the the validateWrite method of the table, if you are satisfied with the validation only taking place when the value is modified from the UI.

like image 34
user50989 Avatar answered Aug 30 '26 07:08

user50989



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!