Agree with Andrej. But I would not create a calculated attribute out of it. Make the attribute a String and add the leading zeros with a MF that calls the StringUtils.Leftpad function of CommunityCommons only when needed.
Calculated attributes are not so good for performance, so I would steer away from it if possible.
Hi Adrian,
IOP there is no simpler way to do this than adding a new calculated string attribute e.g. PaddedNumber. To set this string you can make use of th java actions StringLeftPad in the community commons - https://appstore.home.mendix.com/link/app/170/Mendix/Community-Commons-Function-Library
-Andrej
You could try to create an input box where you can enter leading zero's. When you want to save the value, you have to count the leading zero's and save that in a new attribute. Whenever you load the widget and retrieve your value, you have to retrieve the leading zero's attribute as well and add the zero's. Both attributes will be in one entity of course.
For example: you enter 000123.
You save: '123' as your number integer value and '3' as your leading zero's integer value.
When loading the widget, add 3 x 0 before 123.
I hope this helps you in a way.
Hi Guys,
Sorry to bother you again. I'm a real newbie so apologies for all the noddy questions. :(
When I try to use the CommunityCommons:
I don't see StringUtils in the drop down list, could you tell me what I'm doing wrong?
Cheers
Adrian
I got it to work - thanks for your help guys :)
Thanks Robert :).
If the user is allowed to enter a number which ever way they like, is there a way to display the output of that value in a formatted way - something like %06d?
Should I consider using string fields for the output?
Thanks again
Adrian
Thanks Andrej - I'll check that out. :)