Help Formatting a field

I’m new to Novacura and could use some help with formatting a field.

I have two variables:

  • serial_no (Numeric Variable)
  • counter (Numeric input from the user)

I need to store the serial_no in another variable, formatted based on the length of the counter. Here are a few examples of what I’m trying to achieve:

  • If counter is 100 and serial_no is 1, I want the result to be 001.
  • If counter is 9 and serial_no is 9, I want the result to be 9.
  • If counter is 9999 and serial_no is 8, I want the result to be 0008.

I’ve tried using a script, but it didn’t work as expected. Can someone guide me on how to properly format this?
If possible, send me a screenshot, please.

Thanks in advance for your help!

Hi,

this should do it:

Hope this helps!

B R
Ivan
Test Print Serial increment2.flow (27.0 KB)