Skip to main content

isEmpty (Function)

Function checks if the list is empty.

Syntax

<BOOL> list:isEmpty(<OBJECT> list)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
listThe list that needs to be checked whether it's empty or not.OBJECTNoYes

Example 1

list:isEmpty(stockSymbols)

The list:isEmpty(stockSymbols) function checks if the stockSymbols list is empty. It returns true if the stockSymbols list is empty; otherwise, it returns false.

Example 2

CREATE STREAM InputStream (list OBJECT);
CREATE SINK STREAM OutputStream (isEmpty BOOL);

@info(name = 'EmptyChecker')
INSERT INTO OutputStream
SELECT list:isEmpty(list) AS isEmpty
FROM InputStream;

In this stream worker example, a query named EmptyChecker processes events from the InputStream, which contains a list (list). The list:isEmpty(list) function checks if the list is empty. If the list is empty, then the function outputs true to isEmpty for each event to the OutputStream. If the list is not empty, then the function outputs false to isEmpty.