Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

determining field sequence for barcoded form

Avatar

Level 2

Hi,

In part of designing barcoded form, we will extract the data using handheld scanner to excel file or notepad.

Can we determine the field sequence of extracted data (output) in the form designer?

Need your kind advise for this matter

Thanks,

Raja

1 Accepted Solution

Avatar

Correct answer by
Level 10

Raja,

Here is a simple example of a custom barcode encoding of a PaperFormsBarcode using a pipe-delimiter.

p.png

The text field 'Barcode encoding' contains the value of the PaperFormsBarcode object. It is a useful debugging technique.

The calculate event on the PaperFormsBarcode object does the encoding.

// form1.page1.subform1.barcode::calculate - (JavaScript, client)

if (xfa.host.version < 7.05) {

    this.rawValue = " ";

}

else {

   this.rawValue = encodeBarcode();

}

function encodeBarcode() {

  // define barcode variables

  var firstName;

  var lastName;

  var address1;

  var address2;

  var city;

  var state;

  var zipCode;

  // check First Name for null

  if (form1.page1.subform1.firstName.isNull) {

    firstName = "";

  }

  else {

    firstName = form1.page1.subform1.firstName.rawValue;

  }

  // check Last Name for null

  if (form1.page1.subform1.lastName.isNull) {

    lastName = "";

  }

  else {

    lastName = form1.page1.subform1.lastName.rawValue;

  }

  // check Address for null

  if (form1.page1.subform1.address1.isNull) {

    address1 = "";

  }

  else {

    address1 = form1.page1.subform1.address1.rawValue;

  }

  // check Address for null

  if (form1.page1.subform1.address2.isNull) {

    address2 = "";

  }

  else {

    address2 = form1.page1.subform1.address2.rawValue;

  }

  // check City for null

  if (form1.page1.subform1.city.isNull) {

    city = "";

  }

  else {

    city = form1.page1.subform1.city.rawValue;

  }

  // check State for a null selection

  if (form1.page1.subform1.state.isNull) {

    state = "";

  }

  else {

    state = form1.page1.subform1.state.rawValue;

  }

  // check ZIP Code for null

  if (form1.page1.subform1.zipCode.isNull) {

    zipCode = "";

  }

  else {

    zipCode = form1.page1.subform1.zipCode.rawValue;

  }

  // build barcode string for encoding

  var str = firstName + "|"

  + lastName + "| "

  + address1 + "| "

  + address2 + "| "

  + city + "| "

  + state +  "|"

  + zipCode;

// return the encoding string

return (str);

}

Steve

View solution in original post

0 Replies

Avatar

Level 10

Yes. Use a custom script to encode the barcode.

Steve

Avatar

Level 2

Thanks for the tip

Really appreciate if you can show us example or screenhots of the process.

Raja

Avatar

Correct answer by
Level 10

Raja,

Here is a simple example of a custom barcode encoding of a PaperFormsBarcode using a pipe-delimiter.

p.png

The text field 'Barcode encoding' contains the value of the PaperFormsBarcode object. It is a useful debugging technique.

The calculate event on the PaperFormsBarcode object does the encoding.

// form1.page1.subform1.barcode::calculate - (JavaScript, client)

if (xfa.host.version < 7.05) {

    this.rawValue = " ";

}

else {

   this.rawValue = encodeBarcode();

}

function encodeBarcode() {

  // define barcode variables

  var firstName;

  var lastName;

  var address1;

  var address2;

  var city;

  var state;

  var zipCode;

  // check First Name for null

  if (form1.page1.subform1.firstName.isNull) {

    firstName = "";

  }

  else {

    firstName = form1.page1.subform1.firstName.rawValue;

  }

  // check Last Name for null

  if (form1.page1.subform1.lastName.isNull) {

    lastName = "";

  }

  else {

    lastName = form1.page1.subform1.lastName.rawValue;

  }

  // check Address for null

  if (form1.page1.subform1.address1.isNull) {

    address1 = "";

  }

  else {

    address1 = form1.page1.subform1.address1.rawValue;

  }

  // check Address for null

  if (form1.page1.subform1.address2.isNull) {

    address2 = "";

  }

  else {

    address2 = form1.page1.subform1.address2.rawValue;

  }

  // check City for null

  if (form1.page1.subform1.city.isNull) {

    city = "";

  }

  else {

    city = form1.page1.subform1.city.rawValue;

  }

  // check State for a null selection

  if (form1.page1.subform1.state.isNull) {

    state = "";

  }

  else {

    state = form1.page1.subform1.state.rawValue;

  }

  // check ZIP Code for null

  if (form1.page1.subform1.zipCode.isNull) {

    zipCode = "";

  }

  else {

    zipCode = form1.page1.subform1.zipCode.rawValue;

  }

  // build barcode string for encoding

  var str = firstName + "|"

  + lastName + "| "

  + address1 + "| "

  + address2 + "| "

  + city + "| "

  + state +  "|"

  + zipCode;

// return the encoding string

return (str);

}

Steve

Avatar

Level 2

wow, great! thanks a lot.

After determining the sequence in the form, can I determine the sequence for the output after handheld scanner reads it? (excel file/ notepad format)

Raja

Avatar

Level 10

Yes. The output from a handheld will be exactly the same format as the format encoded in the barcode.