Skip to main content
Question

Adding zeros to a text field if less than 7 digits

  • February 14, 2023
  • 0 replies
  • 78 views

Forum|alt.badge.img+5

Hi,

I have a "Control Number" field that has to be 7 digits.  I need to prefill when it is not.

See example below  I used "1" but it can be any number and I need to make it 7 digits.

1 needs to be 0000001

11  needs to be 0000011

111 needs to be 0000111

1111 needs to be 0001111

11111 needs to be 0011111

111111 needs to be 0111111

Thank you in advance.

Kathy



------------------------------
Kathy Benjamin
------------------------------
This topic has been closed for replies.

Forum|alt.badge.img+20
  • Registered
  • February 14, 2023

var text Num = PadLeft(ToText([Control Number]), 7, "0"); 

$Num

Above is the code to make it 7 digits. Perhaps you can use a dynamic form rule to fill a 'Final Control Number' field. But that code will change the entered number into 7 digits.

------------------------------
Mike Tamoush
------------------------------