Skip to main content
Inspiring
February 19, 2021
Answered

Shorten number string

  • February 19, 2021
  • 1 reply
  • 922 views

I am trying to create an Adobe form for use in a mailroom for package tracking numbers.  The person using the form will utilize a barcode scanner to receive packages from all different carriers (FedEx, UPS, USPS etc)

 

When scanning the barcode on a FedEx label, it populates a 34 digit string of numbers where only the last 12 digits are the actual tracking number.  I would like to use some sort of script within certain text fields to remove the first 22 digits (and only display the last 12).  I am a novice with Javascript and any help is much appreciated. 

 

In addition, if there is a way to use part of the number sequence to identify between FedEx Ground and FedEx Express, that would be awesome

This topic has been closed for replies.
Correct answer joseph0D4B

What do you mean by normal events?  The plan is that the scanner will input the numeric sequence of the barcode followed by a tab key to advance to the next field. 

1 reply

try67
Community Expert
Community Expert
February 19, 2021

The question is whether the scan process triggers the normal events that are triggered when entering a value into a field.

If so, you can do it using this code as the field's custom calculation script:

 

if (event.value) event.value = event.value.substr(-12);

joseph0D4BAuthorCorrect answer
Inspiring
February 22, 2021

What do you mean by normal events?  The plan is that the scanner will input the numeric sequence of the barcode followed by a tab key to advance to the next field. 

try67
Community Expert
Community Expert
February 22, 2021

Just try it and see if it works.