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 6 Current »

Content Freeze

As of July 25th, 2023, there is a content freeze on this page.

The pjs.nullInd() API allows you to get or set the value of a null indicator.

For strongly typed fields with the 'nullable' configuration option, a null indicator can be used to differentiate when a variable is and isn't null.

Parameters
  1. Null-capable field
  2. Set value (Boolean, optional). 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.

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'


RPG Equivalent

%NULLIND()

  • No labels