You are viewing limited content. For full access, please sign in.

Question

Question

token calculator drops leading 0

asked on May 8, 2019

I have a metadata field which houses a document number.  As this number is used in the middle of an intelligent naming convention, we need leading 0's.

The metadata field is set up as a text field as we were unable to get the leading 0's in a number field.  The constraint we have on this field is: \d{3,} as we require it to be at least a 3 digit number, though in some cases it may be longer.

When I get the value as part of my search repository function, it seems to be dropping the leading 0's as when I put this into a token calculator to give me the next incremental number, the test returns without the leading 0's.

What can I do to either retain the leading 0's or add them back in as necessary after the token calculation?

0 0

Replies

replied on May 8, 2019

Use the Token Editor to add Formatting of D#.  The # is replaced by the minimum number of digits.

2 0
replied on May 8, 2019

You can reformat it back to have leading zeros using token formatting.

1 0
replied on May 8, 2019

Miruna,

Thank you for your response.  I have tried this, but my test still only gives me a single digit with no leading 0's, regardless of if I type #"D3"# or #"000"#.  

Any thoughts on if I am doing something wrong or if something else might work better?  Thank you.

0 0
replied on May 8, 2019

Apply the formatting to the results of the Token Calculator token.  See my post below.

2 0
replied on May 8, 2019

You want to do the calculation first, then format. "0001" +1 doesn't mean anything as far as math goes, you want to 1 +1 first, then format the result to have leading zeros.

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.