Hey Philipp,
Are you sure $ContractData/SupplierName is filled and has more than 3 characters? If it is for example empty, then the substring-function will throw an error. So I would add an additional check that checks the following:
length($ContractData/SupplierName) >= 3
If that's the case do you substring. If not… That's for you to decide :)
Hope this helps!
Hi Phillip,
First of all the log (if you're working on a cloud environment) or the console (if you're working locally) will contain more information on the error and will probably point you in the direction of what's wrong.
Secondly, if you want the first three characters, you'll need to change the substring to substring($ContractData/SupplierName,0,3), as the first character of a string is located at index 0.
Hope this helps.
Regards,
Luc
Are the IDs supposed to be unique?
First of all, don’t use a calculated attribute for this purporse, use an After Create event. Othewise everytime you will use this ID your server will have a big amount of stuff to process before you have the response.
To resolve your question you could create an Autonumber support attribute that stats with “100” and concat this attribute with the first 3 company characters like this:
substring($ContractData/SupplierName,1,3) + ‘_’ + toString($ContractData/AutoNumberAttribute)
Hi Philipp Kowalski,
I have answered for a similar question , you can check the below forum question for your reference.
https://forum.mendix.com/link/questions/106097 .
Hope it helps!!
If you are not able to solve it. I can you help you ATB!!