Page tree
Skip to end of metadata
Go to start of metadata

The pjs.get() API will return the value of a field. It is useful when you want to refer to a field name dynamically.

Parameters
  1. Field name
Return value

Field value

Example
pjs.define("field1", { type: 'char', length: 1, initValue: 'A' });
pjs.define("field2", { type: 'char', length: 1, initValue: 'B' });
pjs.define("field3", { type: 'char', length: 1, initValue: 'C' });
pjs.define("field4", { type: 'char', length: 1, initValue: 'D' });

var output = "";
for (var x = 1; x <= 4; x++) {
  var fieldName = "field" + x;
  output += pjs.get(fieldName);
}

// output is "ABCD"