Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
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
Former Community Member

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

5 Replies

Avatar

Former Community Member

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
Former Community Member

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

Former Community Member

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

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----