These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Problem with combed field

PetafromOz
Registered: Jun 8 2009
Posts: 230
Answered

I have a numeric field with a comb of 4.

The user enters a code no. into this field which can be anywhere from 2-4 digits It can't be less than 2 digits. I need a script that will only look at the value of the 1st 2 digits as the last 2 are incidental to our needs. eg: if the first 2 digits are 12, display "medium" in the risk factor text field. If the first 2 digits are 38, display "high" in the risk factor field. Same would apply if they entered 3 or 4 digits - eg 1264 would still display "medium" and 3802 would still display "high".

How can I tell it to only look at the first 2 digits in the field?

from way... underground at Parkes - central West NSW - Australia

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
FormCalc can do this with:

var FirstTwoChars = Left(Rtrim(NumericField1), 2)

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

PetafromOz
Registered: Jun 8 2009
Posts: 230
Genius yet again Radzmar. I had to fiddle with it a bit because it's ages since I've used FormCalc & kept getting syntax problems. But... I figured it out in the end.The only problem now is that if the user enters only 2 digits, it right aligns it with leading zeroes. So instead of it reading '05', with a couple of blank slots to the right, it now converts it to read '0005'.

The pattern I set up is to allow zeroes (otherwise it drops off the leading zero altogether), and num{9999}. Should I set this up differently?

from way... underground at Parkes - central West NSW - Australia

PetafromOz
Registered: Jun 8 2009
Posts: 230
Ah, finally I fixed my own problem. I converted the field to a text field, adjusted the script accordingly, and set the Display & Edit patterns to text{9999}. And now it works perfectly.
Thanks Radzmar.

from way... underground at Parkes - central West NSW - Australia