Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

The 'nullInd' method will allow you to get or set the value of a null-indicator.

Since variables in Profound.js cannot technically be 'null', we can use a null indicator to differenciate when a variable is and isn't null.

Parameters
  1. Null-capable variable.
  2. (Optional) Boolean. True to set the indicator to null and false vice-versa.

Return Value

  • True or false, true indicator that the variable is null.
Examples

Example 1: Nullable field with internal null-indicator.

  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();

Example 2: Nullable field with variable null-indicator.

  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'
  • No labels