Skip to content

source.checkNodeIsBlank

Use when: You want to read values from the original incoming message before any mapping changes. If you need the modified message during mapping, use message.checkNodeIsBlank.

Signature: source.checkNodeIsBlank(nodePath, instance*, repetition*)

Returns: Boolean isBlank - true if the node is not found, null, empty or whitespace

Checks if a node that matches the nodePath exists and is whitespace, empty ('') or null.

Note

This method will check if the node exists. If the node does NOT exist it will return true. If the node does exist it will check its value. Returns true if blank else false.

Note

This method only applies to the following formatted messages: HL7, ASTM, CSV, DICOM, EDIFACT, Old Fxd Width, Fxd Length, ISO 8583, JSON, Text, X12, XML.

Parameters

Type Name Description Default
String nodePath the node path (XPath, HPath, Column ID, etc.)
Integer instance* (optional) the instance to return: segment for HL7, ASTM, EDIFACT, or X12; row for CSV (0=header row) or fixed-length formats; or match for DICOM, JSON, or XML. Use 1 for the first instance. 1
Integer repetition* (optional) the field repeat instance for HL7 or ASTM to return. Use 1 for the first instance. 1

Examples

hl7

// Given an HL7 source message with populated PID fields.
/* source:
'MSH|^~\\&|SendingApp|SendingFac|ReceivingApp|ReceivingFac|202311071015||ADT^A01|1234|P|2.5\r' +
'PID|1||123456^^^&1.2.3.4&ISO||Doe^John||19700101|M|||123 Main St^^Metropolis^NY^54321||(123)456-7890'
*/

// Check if the alternate patient ID (PID-4) is blank.
if (source.checkNodeIsBlank('PID-4')) {
    // No alternate patient identifier was supplied.
}

// Check if the county code (PID-12) is blank for the first instance (1-based).
if (source.checkNodeIsBlank(
        'PID-12',   // nodePath
        1           // instance (1-based)
    )) {
    // The first PID segment carries no county code.
}

json

// Example: Check whether a node exists and is blank (null, empty, or whitespace).

/* Sample JSON source structure:
{"people":[
    {"name":"David","favoriteFood":""},
    {"name":"Nate","favoriteFood":"Lasagna"}
]}
*/

if (source.checkNodeIsBlank('/people/[name=David]/favoriteFood')) {
    // David supplied no favorite food.
}

xml

// Example: Check whether a node exists and is blank (null, empty, or whitespace).

/* Sample XML source structure:
<patient>
   <name>Jane Doe</name>
   <spouseName></spouseName>
</patient>
*/

if (source.checkNodeIsBlank('/patient/spouseName')) {
    // The spouse name element is present but empty.
}