Link to home
Start Free TrialLog in
Avatar of Paer Toernell
Paer ToernellFlag for Thailand

asked on

Invoice rownumbers (tdataset), where am I

Creating invoices. Would like to have a rownumber for each invoiceline (the article, quantity etc). I'm trying to use a calculated field, but how to get the rownumber? I'm using Unidac.
ASKER CERTIFIED SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
it depends on where you want this ... and where you want it stored
and what type of database you are using

typically it's done at insert of the record
> using a trigger with a sequence number or autonumber field

for detail records, it's not really required
it can be generated with a certain sort order

sample select with generated row numbers per invoice
select 
  row_number() over (partition by invoice_id order by article, quantity) as detail_row, 
  d.*
from invoice_details d 

Open in new window