AutoIncrement (by 10) at change in Field

Medea

Registered User.
Local time
Yesterday, 21:28
Joined
Oct 18, 2007
Messages
19
Hello,

I have an issue that may or may not be an easy fix. Either way, I am at a loss and would appritiate ANY help!!!!!

I import data from excel in order to cleane and format it to migrate it. One field is blank but needs to be auto numbered 10, 20, 30, etc at each change in Order number. See attachment.


The only 2 constinents I have are Order and date. So, as you can see, each new order needs to start at 10 and ADD 10 until the next order number then we begin again.

Hope I explained this well enough!!! Thanks in advance for any insight...

Trish
 

Attachments

Check the attachment ...


The thing about this is because it uses a global variable, you will need to reset it before you run the query again.

You can do this anywhere in your code by calling the function ...

Code:
Call GetLineCounterReset()

-dK
 

Attachments

Thanks! That works great for incrementing but I also need it to find the changes in order number.

Ex: Order # 1234 may have 3 line items - so I would need 10,20,30. Order # 2345 may have 5 line items - 10, 20, 30, 40 50.

I will play with the "GetLineCounterReset()" and see what I get.

Again, Thanks so much!

Trish
 
Sorry, I forgot that bit. Here is a new attachment ...

The important bit here is that the query is sorted or else it will reset your line counter. This is because it stores the 'sometext' in a global variable and logically decides to increment the line counter or reset it to 10.

This could possibly be done a little cleaner. A bit more logic to catch that first one as I did on the GroupData. Just some food for thought to get you going ...

-dK
 

Attachments

Last edited:
You are a god!!!!!! Thank you!!!!!

Trish
 
If I was one of those, Sed's issue would have been resolved by now. :rolleyes:

I have just ran into something like this before.

-dK
 

Users who are viewing this thread

Back
Top Bottom