Something wrong with expression node

In a “column list loop”, I would like to count the values -9999. My column is an integer. But when I put
if($[currentColumnName] = -9999, 1, 0)
indicate by K-IA !!

it tells me
Operator ‘==’ is not applicable for STRING and INTEGER
When I put
if($$[“currentColumnName”] => ‘-9999’,1,0)
nothing comes out (no 1 in the row)

I even tried
if(join(“”,“$[\‘’,string($$currentColumnName),”\“]”) = -9999,1,0)

How can I count these -9999 values in my column?

thx for your help, I hope this is more useful than the AI :grinning_face_with_smiling_eyes:

I don’t have an explanation for the problem with the Expressions node. Try this. Its a little crude, but works.

Hi,

the variable “currentColumnName” is just the name of the current column. Therefore the expression does not test the “CurrentColumn” but the name of the current column if its called “-9999” :slight_smile:

Maybe there’s a more efficient approach than mine, but in the case of a column wise looping I rename the current column to a generic name, apply the math operations and rename it back:

But in general if you just want to count the number of -9999 values I suggest to use a unpivot and groupby node.

1 Like