Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


The 'nullInd' method will allow pjs.nullInd() API allows you to get or set the value of a null - indicator.

Since variables in Profound.js cannot technically be 'null', we can use For strongly typed fields with the 'nullable' configuration option, a null indicator can be used to differenciate differentiate when a variable is and isn't null.

Parameters
  1. Null-capable variable.field
  2. Set value (OptionalBoolean, optional) Boolean. True to set the indicator to null and false vice-versa. If this parameter is passed, the Null indicator is set (true for null, false for not null); otherwise, the null indicator is simply retrieved and returned.

Return Value

...

Boolean value indicating whether the field is null

...

Examples

Example 1: Nullable field with internal null-indicator.

Code Block
languagejavascript
  pjs.define("data", { type: 'char', length: 50, varying: true });
 
pjs.define("myNumber", { 
 
  type: 'packed decimal',
 
  length: 10,
    decimals: 0,
    nullable: true 
  });



pjs.nullInd(myNumber, true);

 data = pjs.nullInd(myNumber).toString();

...

Code Block
languagejavascript
  pjs.define("data", { type: 'char', length: 50, varying: true });
  pjs.define("myBoolean", { type: 'boolean', initValue: true });
 
pjs.define("myNumber", { 
    type: 'packed decimal',
    length: 10,
    decimals: 0,
    nullable: 'myBoolean'  
 });

  myBoolean = false;  // Changes %nullind(myNumber) to *Off
 
pjs.nullInd(myNumber, true);  // Changes myBoolean to *On
 
data += pjs.nullInd(myNumber).toString() + myBoolean.toString();  // data is now '11'

...


RPG Equivalent

%NULLIND()