isNull() function

21 views
Skip to first unread message

fabius pocus

unread,
Oct 1, 2022, 6:06:19 PM10/1/22
to OpenRefine
Hi guys! I suppose that isNull() is a function like the others. But I have a different behaviour between:

value.isNull()

and 

isNull(value)

Right? Thanks,

Fabio

Owen Stephens

unread,
Oct 3, 2022, 4:30:20 AM10/3/22
to OpenRefine
Hi Fabio,

If you look at the GREL Help in the application (the Help tab in the Transform popup) GREL expressions are split down into variables, functions and controls. isNull() is technically a 'control' rather than a function, and this changes the way it can be written.

Functions can be written either like:
value.function()
OR
function(value)

However controls can only ever be written one way:
control(value)

This is because of some technical design issues. From the documentation "GREL offers controls to support branching and looping (that is, “if” and “for” functions), but unlike functions, their arguments don't all get evaluated before they get run. A control can decide which part of the code to execute and can affect the environment bindings. Functions, on the other hand, can't do either. Each control decides which of their arguments to evaluate to value, and how."

Owen

fabius pocus

unread,
Oct 3, 2022, 5:19:52 PM10/3/22
to OpenRefine
Thanks Owen.

Fabio

Reply all
Reply to author
Forward
0 new messages