Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

unique number from database on each row of crystal report

  • 28-02-2012 02:17AM
    #1
    Registered Users, Registered Users 2 Posts: 208 ✭✭


    I have a crystal report which is populated by a view on a SQL Server DB. On the report, I would like to put a barcode containing a unique ref number on each row of the report. The unique number would be derived from a number held on a table in the database and incremented for each row. The table is needed to ensure unique and sequential numbers, plus I may need to format the numbers for the report.

    My initial thought was to use a function call as a column within the view, but you cannot update the database (seed number) from a function. For every other way I have come up with for this, the number wil not be incremented and returned for each line in the dataset.

    Would anyone have any ideas on how this could be done? Any help/pointers would be appreciated.

    Whitey


Comments

  • Registered Users, Registered Users 2 Posts: 12,025 ✭✭✭✭Giblet


    Don't know anything about Crystal, in SQL you would do this, if it's any help. (Although just using ROW_NUMBER instead of id + ROW_NUMBER might server the same function
    select *,id + ROW_NUMBER() OVER(ORDER BY id asc)  from myTable
    


Advertisement