Question
TCS
GB
Last activity: 9 Aug 2021 6:12 EDT
Integer properties truncating leading zeros on save or tabout
We have a section refering integer property. User is trying to enter integer values with leading zeros for ex. 000123 and after submit value is being changed to 123. Anything that we can do without changing the property ? As this code already deployed in production and we have inflight cases updating to new text property is causing data loss.
Thanks in Advance
@Ravi Kumar As far as I know, it is not possible to store the string "000123" as an integer, it will always change to 123.
I would try:
- Change the property type to Text by blocking or withdrawing the old one and re-creating it (if it is not already optimized)
- Create a text property and define a declare expression to sync its value to the integer property but with "0" leading. Obviously, you will need to refactor the rules that reference the integer property and modify them to reference the new text property.
- If creating a new text property is causing old data loss, then you may add a step to the pyDefault data transform and set .NewTextProperty = @YourZeroLeadingFormatFunction(.OldIntegerProperty). Or maybe you can create an activity that loops through the old cases and populate the .NewTextProperty with @YourZeroLeadingFormatFunction(.OldIntegerProperty) similar to the column population job.