coding doubt about how to update a variable


A header and detail table are created for generating labels.

After label is generated, generated values needs to be updated in a HistoryTable. History table has fields labelId and ItemId, etc.

(An example ) - ShipmentItemId is an x++ variable that holds data.

label Detail Table has following fields

label 1:

FieldID FieldValue FieldConversion FieldLength

ItemId ShipmentItemid 20

here Itemid has to be updated with ShipmentItemid value ‘ITEM1’

Label 2:

FieldID FieldValue FieldConversion FieldLength

ItemId ShipmentItemid Static Value ‘MIXED’ 20

here ItemId has to be updated with ‘MIXED’ (static text value)

So when label1 is generated, history table needs to be updated, as

LabelId Itemid … RecId

label1 ‘ITEM1’ … xxxxxxxxxx

When label2 is generated history table needs to be updated as

LabelId Itemid … RecId

label2 ‘MIXED’ … xxxxxxxxxx

static void Job8(Args _args)

LabelsDtl LabelsDtl;
Historytable Labels;
LabelId _labelId = ‘label1’;
SysDictTable sysDictTable = new SysDictTable(tableNum(Historytable));
SysDictField sysDictField;
int i;
str fieldname, shipmentItemid = ‘ITEM1’;

labels.labelid = _labelId;

for(i=1;i<= sysDictTable.fieldCnt();i++)
////***** fieldname holds FieldID value of History table (here ItemId)

fieldname = SysDictTable.fieldName(sysDictTable.fieldCnt2Id(i));

Labels.(SysDictTable.fieldName2Id(fieldname)) = LabelsDtl::find(_labelId,fieldname).FieldValue;

print Labels.ItemId;


LabelsDtl::find(_labelId,fieldname).FieldValue is “ShipmentItemId” but I want the variable value ‘ITEM1’ to be populated at this place.

Any ideas how to handle this would be appreciated.