ELEMENT.EXISTS()

ELEMENT.EXISTS()

Top  Previous  Next

 

The ELEMENT.EXISTS() function tests whether an element exists in a data collection.

 

 

Format

 

ELEMENT.EXISTS(var{path})

 

where

 

varis a data collection variable.

 

pathis the element path to be tested. The {} characters are part of the function syntax.

 

 

The ELEMENT.EXISTS() function scans var to test whether element path exists. The function returns True if it is found, False if not.

 

 

Example

 

COL = JPARSE(JSON.STRING)

IF NOT(ELEMENT.EXISTS(COL{'CLIENT', 'AGENT.CODE') THEN

  STOP 'Agent code not found'

END

 

The above code fragment parses a JSON string into a data collection and then checks whether the CLIENT/AGENT.CODE element is present.