Jump to content
Sign in to follow this  
Mandu

Assign serial number for group of records

Recommended Posts

I have a table of LineItems sorted by Invoice_ID, and I need to assign an Transaction Number to each LineItem record, as follows:

Inv_ID TXN_No etc...

C10001 1

C10001 1

C10001 1

C10002 2

C10003 3

C10003 3

In other words, I want TXN_No to increment every time Inv_ID changes. Seems like it should be an easy calc or summary but I can't spot it. Anyone?

Thanks,

Chap

Share this post


Link to post
Share on other sites

How about:

GetAsNumber ( Right ( Inv_ID ; 4 ) ) ?

Share this post


Link to post
Share on other sites

I'd prefer a technique that is guaranteed to assign numbers sequentially, beginning with 1, regardless of the Inv_ID. I should have illustrated that in my example.

Share this post


Link to post
Share on other sites

Are you ok with a scripted process?

Create a new Field in your table.


# sort by your invoice number

Sort Records [Restore;No Dialog]

Go to Record/Request/Page [First]

Loop

Set Variable [$i; Value:Case($inv = Table::InvoiceID ; $i + 1 ; $i)]

Set Variable [$inv ; Value:Table::InvoiceID]

Set Field [Table::NewField; $i]

Go to Record/Requiest/Page [Next; Exit after last]

End Loop

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.