You could use a calculated Temp field and increment it on each record but this would be making several assumptions. Does your source file only contain the tracking numbers and package numbers for an invoice or is it also used to contain item information that would need to go into SO_InvoiceDetail?
If the former, i think the temp field would be enough but it would be assuming that every line is a different tracking number although i suppose you could use some conditional checks to determine when to reset the package number to 0 and when to increment it.
You can either use a single string temp field or a numeric temp field and a string temp field. If you use a single string temp field, the calculation would look something like this on the temp field Temp001$.
STR(NUM(Temp001$)+1:"0000"))
If your source contains lines for multiple invoices, you will definitely need to work in logic to reset it to 0.
This also assumes you are only ever going to import lines for any given invoice once, if you import 3 lines one time for an invoice and then they import 2 more lines, each containing a tracking number not imported previously, then these two lines will overwrite the first two lines imported previously.
The surest way to avoid conflicts would be to use either perform logic or a script to use the tracking number as an alternate "key" using GetResultSets since SO_InvoiceTracking only has a primary index consisting of the invoice number and the package number, i'm surprised there isn't an alternate one including the tracking number. This would check each tracking number in the source against existing records for the current invoice and if the tracking number exists, then, update that record, if not, then find the next available package number for the current invoice.
------------------------------
David Speck II
Tennessee Software Solutions
------------------------------