Problem:
When migrating a field, leading zeroes "0" are in front of a value when not intended.
Solution:
The Index Field must be a numeric field and you use Output format for the Field on Field Settings in the migration . To pad to 6 characters you would use “D6” or “000000”. If you leave the Index Field text your leading 0’s will never appear:
Script:
** Edit the field names and the number after the D is how many leading zeroes you want**
if (dataField.Name == "Digits") { int numericValue = 0; if(int.TryParse(dataField.StringValue, out numericValue)) dataField.Value = numericValue.ToString("D10"); }
Comments
Please sign in to leave a comment.