MSExcel-like formulae

Hi all,

I wish to append a column to a table with an integer number, using something like an MSExcel formula. For example: 

=IF(A1=A2,B1,B1+1)

=IF(A2=A3,B2,B2+1) etc

Would the Math Formula node be sufficient for this (and if it is, then how exactly do I go about that because I can't seem to get that to work), or should I instead look at a Python script?

Thanks,

njt

The Math Formula won't work, because you are looking ahead and accessing the next row already. The Java Snippet works the same and only allows row-wise processing or using the Global Declaration to store intermediate results - so I guess if you sort the table reversly you can work with the Java Snippet. The Python or R nodes would be an option.

Why not use the Rule Engine node?

Well, I don't believe the rule engine node could do that either, looking ahead in rows.

as far as I know the only way to do this is with some looping using the delegating loop start and end nodes. It's not trivial, but possible!

Simon.

Oh, sorry, I missed the lookahead point. I remeber someone suggesting a lookahead/behind functionality for the Rule Engine. Let's see if this can be integrated somehow.

Thanks all! I'm giving Python a go, but I'll see what I can achieve with some looping.