Warning/error when max value of source attributes is larger than max value of target attribute - Mendix Forum

Warning/error when max value of source attributes is larger than max value of target attribute

4

Often, in a Change Object action, you set the value of one attribute based on the value of another (or multiple) attributes. Here, it can occur that the max length of the target attribute will be exceeded.

For example, you have attributes FirstName and LastName, both with a max value of 200 chars. You also have an attribute FullName with a max chars of 350. FullName is set to FirstName + LastName. In theory, it could happen that you try to set a value of 400 chars in an attribute with a max value of 350 chars, thus resulting in an error during runtime.

Currently, the modeler allows this, and it is completely up to the developer to make sure you won’t exceed the max value of your target attribute. This is something that is very likely to be forgotten, and sooner or later, you will have a situation where the max value of the target attribute is exceed, .

It would be awesome if the modeler would make it easy for the developer to handle this situation, and detect that the max value of the target attribute is smaller than the max value of the source attributes that are being used to set the target attribute. The modeler could give a warning, or maybe even an error, because this is something that is an accident waiting to happen and you want this situation to be handled during development.

asked
0 answers