Expand my Community achievements bar.

Merge values of 4 fields into 1

Avatar

Level 2

I have 4 fields that I need to merge into one. 

Field names

bccust

bcloan

bcdoc

bcdate

I have tried making them text fields and I can merge the values that way but can not get leading zeros to stay in place. 

Code

this.rawValue = bccust.rawValue + "" + bcnote.rawValue + "" + bcdoc.rawValue + "" + bcdate.rawValue;

What I need is a way to say the bccust is 10 char long and if the user does not enter 10 char it puts leading zeros.  bcloan is 5 char long and if the user does not enter 5 char it puts leading zeros.  bc doc has a static value.  bc date i do not want leading zeros.  I have tried to use numeric fields no luck there either.  It puts all the leading zeros in the front.

1 Reply

Avatar

Level 10

Hi,  bccust.formattedValue will give you the value as displayed using the display patterns set if that helps, otherwise there us some formatting functions avaliable, util.printf and util.printd which are described in the "JavaScript™ for Acrobat® API Reference"