I noticed that a GREL function will not be called at all if any of its parameters is an existing error value (EvalError). In this case, the EvalError is returned without calling the GREL function.
To reproduce it, import the following csv:
- apply a GREL transformation (Edit Cells > Transform ..) "toNumber(cells.my_source.value)" on the column my_result
- select onError: store error
-> the my_result has an error on the second row "Unable to parse as number" (which is expected)
Now, try a new transformation on the my_result cell and use any function which takes the value of my_source as parameter. The function will never be called for the row which has already and error.
So this essentially prevents any custom Grel functions to perform any processing on error values.
In my case, I implemented and registered a custom function from which I do return a EvalError in some cases. This is useful to indicate to the user that something is wrong.
My function takes as parameter the column which resulted in a previous run. This allows me to do faster processing in case a correct value is already present and do the processing only in case of missing or error values. So the call os something like
my_function("foo bar", cells.my_result.value)
However, my function is never called for rows where my_result was previously set to an EvalError.
The workaround could be to use a if condition like so
my_function("foo bar", if(isError(cells.my_result.value), null, cells.my_result.value))
but that's a bit cumbersome to use.
Is this the expected behaviour during the Grel evaluation?
thanks in advance