Question

I have a requirement to make some data retrieval using barcode EAN128.

In form there must be 2 controls; the first is itemId and 2nd is nameAlias, both from inventTable. My issue is that when user will scan the itemId it must retrieve the nameAlias too in the second control. So for that I made two display methods in my table which I'm using as datasource.

I dragged those methods into my form's design.

This is the first control's code:

public display BarcodeString myB()
{
  Barcode barcode;
  InventTable inv;
  ;
  barcode = Barcode::construct(BarcodeType::EAN128);
  barcode.string(true, inv.ItemId);
  barcode.encode();

  return barcode.barcodeStr();
}

This is code for the second control, which must retrieve the nameAlias

Public display ItemNameAlias qty()
{
  return InventTable::find(this.myB()).NameAlias;
}

Thanks in advance for the help.

Was it helpful?

Solution

You have mixed up barcode printing and barcode data entry.

When printing you need to process your item id into a string suitable for the barcode font. This is what the barcodeStr method do.

On entry you need a scanner. The scanner gives you your item id, as if you have entered it your self. Thus no further processing of the barcode is needed. The scanner takes care of that.

Provided you have an ItemId field in your table, create a display method for that table:

display ItemNameAlias nameAlias()
{
    return InventTable::find(this.ItemId).NameAlias;
}

Do not copy the method to the form, but reference it from the form as described here. In your form you will have two controls, ItemId bound to your field and nameAlias refering to your display method.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top