Adding a "Sequential count based on case"

Greetings Folks,

What would be a good way of adding a new “Sequential count based on case” column to a table that counts upwards each row based on how many times the same-same value occurs in another Data_Field?

For example, something like the Count column in this screenshot:

Many thanks in advance,

You can already do this with Total by setting the By field to the first column. Just use New Col add a column of 1s first.

sequential-count.transform (2.0 KB)

1 Like

Just noticed that the result of the transform says ‘0 rows totalled’. I have fixed that now. Fix will be in the next release. Please report anything like this you spot!

1 Like

Thanks for pointing out the “Total” transform.
Exactly what I need (if it worked…)

I was also trying to use OFFSET in combination with an IF transform
to flag when one set of records ends and the next begins
however the IF statement always incorrectly returns zero.

What am I doing wrong?

Simple Test.txt input file
Test.txt (38 Bytes)

Test Transform:
Test_offset.transform (2.8 KB)

I will investigate and get back to you.

The reason this isn’t working is because you currently can’t use column variables (such as $(Offset)) for the IF part of the transform. Only for the THEN or ELSE. Other people have been caught out by this and we hope to add this feature soon.

In the meantime you can use Compare instead.

1 Like