pjs.clear()
The pjs.clear() API can be used to clear the contents of a field or record format. For example, clearing a character field will set it to blanks and clearing a numeric field will set it to 0.
Parameter
Field or record format name
options: Only needed when clearing a record format
all - Use when need to clear all fields, even the input only fields
nokey - Use when you want to clear all field except for the key fields
Example
pjs.define("s", { type: 'char', length: 3 });
s = '123'; // s is now '123'
pjs.clear(s); // s is now ' '
pjs.define("n", { type: 'integer', length: 5, decimals: 0, dim:3 });
n[1] = 12334; // n is now 12334,0,0
pjs.clear(n); // n is now 0,0,0
pjs.defineDisplay("display", "productd.json");
/*...*/
pjs.clear("main", { all: true }); // Clear all fields, even the input only fields, of record format "main" for a display
// displays do not have keys, so including it will have no affect
pjs.defineTable("productsp", { read: true, keyed: true });
/*...*/
pjs.clear("products", { nokey: true }); // Clear non input only, non-key fields of record format "products" for a table
pjs.clear("products", { all: true, nokey: true }); // Clear all non-key fields of record format "products" for a table
pjs.clear("products", { all: true }); // Clear all fields of record format "products" for a table
RPG Equivalent
CLEAR