Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Does anyone have an idea of how to create a 'counter flag' when runnign a script ? Suppose I have fields (or a combination of fields that make up the key)
AAABBBCCC
AAABBBCCC
AAABBBDDD
AAABBBDDD
AAABBBEEE
AAABBBCCC
I want to be able to set a flag so that I get
field Counter
AAABBBCCC 1
AAABBBCCC 1
AAABBBDDD 2
AAABBBDDD 2
AAABBBDDD 2
AAABBBEEE 3
AAABBBCCC 4.
AUTONUMBER takes me partially there but this would duplicate a counter of '1' for the final AAABBBCCC. I need to have a new number for this field because of the rest of the data that is held on this field (it's complicated but it holds all sorts of numbers which I'm doing calculations on so I can't sort on any other fields - however, assuming the data is correctly ordered above, any help would be appreciated).
Maybe like this:
LOAD Field,
if(recno()=1,1,if(peek(Field) = Field, peek(Flag),peek(Flag)+1)) as Flag
INLINE [
Field
AAABBBCCC
AAABBBCCC
AAABBBDDD
AAABBBDDD
AAABBBEEE
AAABBBCCC
];
Maybe like this:
LOAD Field,
if(recno()=1,1,if(peek(Field) = Field, peek(Flag),peek(Flag)+1)) as Flag
INLINE [
Field
AAABBBCCC
AAABBBCCC
AAABBBDDD
AAABBBDDD
AAABBBEEE
AAABBBCCC
];
Thanks for this. It is exactly what I needed. Works perfectly