get max length of string attribute on entity in java

1
Hello,   I’m working on a Java-Action which sets some values on an object, I received the following exception: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.core.CoreRuntimeException: Attribute '...Number' has a maximum length of 15, tried setting a value of length 19. at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:156) Caused by: com.mendix.core.CoreRuntimeException: Attribute '...Number' has a maximum length of 15, tried setting a value of length 19. at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36) Caused by: Attribute 'RequestFulfilment.Request.Number' has a maximum length of 15, tried setting a value of length 19. at com.mendix.basis.objectmanagement.member.MendixStringImpl.checkLength(MendixStringImpl.java:69) at com.mendix.basis.objectmanagement.member.MendixStringImpl.setValue(MendixStringImpl.java:62) at com.mendix.basis.objectmanagement.member.MendixStringImpl.setValue(MendixStringImpl.java:12) at com.mendix.basis.objectmanagement.MendixObjectMemberImpl.setValue(MendixObjectMemberImpl.java:228) at Note: “Attribute '...Number' has a maximum length of 15, tried setting a value of length 19.” Is there a way I can get the maximum allowed length (15 in this case) in java? Otherwise I just have to wrap it in a try-catch to handle it. Thanks - Tobias
asked
1 answers
3

Hi Tobias,

I have not tried that one,

https://apidocs.mendix.com/7/runtime/com/mendix/systemwideinterfaces/core/meta/IMetaPrimitive.html

 

    int getLength()

    Returns:
        the length

might refer to the length of the attribute and not the max length. Could not find anything else that might fit, though..

answered