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

Question

Question

Quick Fields substitution to add leading zeros?

asked on December 7, 2020

What would I need to add to this to get QuickFields to add leading zeros?

  • Zone OCR grabbed this:     NW-9-43-9-4
  • I want it to substitute this:  NW-09-043-09-4

 

It needs to add the leading zeros only if the middle three sections are not (2 digits)-(3 digits)-(2 digits).

0 0

Replies

replied on December 9, 2020

Hi Connie, after scratching my head on this a bit, I don't see how Substitution is going to work for this, but that could just be me. 

But I was able to come up with this.

Step 1: Use Pattern Matching Regex to extract the parts from your Zone OCR. You need a Separate Pattern for each part of the string, example below

Pattern 1 (\w\w)

Pattern 2 \w\w-(\d{1,2})

Pattern 3 \w\w-\d{1,2}-(\d{1,2})

etc

Now create an Assign Token Activity below the Pattern Matching Activity and add these tokens into that Token Pattern1-Pattern2-Pattern3-etc

Right Click on each Pattern token for each Number pattern and choose Token Editor. Under Apply Formatting put D2. This will force the Digits always be 2 places

 

You would now have your values formatted as you were looking for and would apply this to your metadata field.

Hope this works for you

Steve

 

2 0
replied on December 9, 2020

That would work.  Thanks, Steve!

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

Sign in to reply to this post.