Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to put a progressive number for each record (and for any kind of record)

If I have a table like this:

ID AMOUNT

160 200

160 300

120 100

130 340

160 140

130 350

How can I calculate a progressive number for any kind of IDs ?!?!

I need a table like this:

ID AMOUNT PROGR

160 200 1

160 300 2

120 100 1

130 340 1

160 140 3

130 350 2



and so on......

Anyone can give a solution please?

1 Solution

Accepted Solutions
hectorgarcia
Partner - Creator III
Partner - Creator III

May you can find useful this small exmaple og accumulation by aggregation

View solution in original post

2 Replies
hectorgarcia
Partner - Creator III
Partner - Creator III

May you can find useful this small exmaple og accumulation by aggregation

Anonymous
Not applicable
Author

Hi Radeon,

One way is to sort the initial table on ID and some other field that specifies the order, Date, LineNo or similar. Then you can use peek on every row and see if the previous ID is the same as the ID on the current row and if it is, you peek at the PROGR value from the previous row and add 1 to it. If the ID is different, you set PROGR to 1 for that row.

There should be some examples on Peek here in the forums, and I also recommend checking it out in the F1 help and the ref manual.

//JSN