MAXLEN error on saving %Persistent class
Hi,
When we define a %String property, and don't mention any MAXLEN, by default it uses 50 as defined in class %Library.String.
As a result, when we try to save data more than 50 characters, it fails with below error.
ERROR #7201: Datatype value 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' length longer than MAXLEN allowed of 50
This is very challenging when we parse data and tries to store it in SDA3 structure, because in many places its always set to 50, which is not enough.
We have been fighting a lot to avoid MAXLEN error in various scenarios and in various part of the products over a long period of times.
The general solution we have been opting so far is, whenever we encounter this error, we make that string property to use MAXLEN=””.
Now, this is a kind of hit and trial method, and exhaustive in order to change so many properties in SDA3 structure.
What if we persists this class %Library.String in our product git, with below code change.
I know it is not recommended at all to change any library class, but without this there is no other solution.
We just need to be cautious about HSF upgrade, and make sure we take the latest and check in to our git with the below change all the time.
Benefit: WE WILL NEVER ENCOUNTER MAXLEN ERROR
Class: %Library.String
Currently it is:
/// The maximum number of characters the string can contain.
Parameter MAXLEN As INTEGER = 50;
We change it to:
/// The maximum number of characters the string can contain.
Parameter MAXLEN As INTEGER;
*** Do you see any drawback or issues with this? Can there be any other impact due to this?