Skip to main content

Query the Vault from filter JavaScript

Filter JavaScript reference

Query NIM's Vault from a filter-specific JavaScript column when the calculation needs to check another collected record.

Use these helpers in a JavaScript filter column. Before querying, make sure the target system has been collected and its table has the appropriate primary or reference key.

Choose and use a Vault helperDirect link to Choose and use a Vault helper

Match the helper to the questionDirect link to Match the helper to the question

If you need to…Use
Check whether a primary-key value existsvaultObjectExists
Check whether a value exists in a reference columnvaultObjectExistsByRef
Retrieve matching records for an exceptional casevaultObjectFind

Prefer one of the Boolean existence checks whenever possible. They are simpler and more efficient than retrieving records.

Step 1 of 3

vaultObjectExistsDirect link to vaultobjectexists

Returns true when a record in the specified table has a primary-key value equal to the lookup value; otherwise returns false.

ArgumentRequiredTypeDescription
System nameYesStringName of the collected NIM system.
Table nameYesStringName of the system table.
Lookup valueYesStringPrimary-key value to find.
return vaultObjectExists('hr500', 'employees', '10023963');

Use this helper to make a decision based on whether a known object exists—for example, selecting a default value when the expected target object is absent.

vaultObjectExistsByRefDirect link to vaultobjectexistsbyref

Returns true when a row contains the lookup value in the specified reference column; otherwise returns false. The selected column must be configured as a reference key.

ArgumentRequiredTypeDescription
System nameYesStringName of the collected NIM system.
Table nameYesStringName of the system table.
Reference columnYesStringReference-key column to search.
Lookup valueYesStringValue to find in that column.
return vaultObjectExistsByRef('hr500', 'employees', 'ssn', '999-888-7777');

vaultObjectFindDirect link to vaultobjectfind

Returns an array of records whose reference column matches the lookup value. If there is no match, it returns an empty array.

ArgumentRequiredTypeDescription
System nameYesStringName of the collected NIM system.
Table nameYesStringName of the system table.
Reference columnYesStringReference-key column to search.
Lookup valueYesStringValue to find in that column.
Case-sensitive flagNoBooleanWhether NIM matches the lookup value case-sensitively.
const matches = vaultObjectFind('hr500', 'employees', 'ssn', '999-888-7777');
return matches.length > 0 ? matches[0]['FirstName'] : '';
caution

vaultObjectFind can be computationally expensive. Avoid it in high-volume production calculations when an existence check or a filter relation can solve the problem.