Alpha Video Training
Results 1 to 3 of 3

Thread: How do you set numbering in multi-tenant apps?

  1. #1
    "Certified" Alphaholic
    Real Name
    Jaime Ben David
    Join Date
    Jan 2011
    Location
    Karkur, Israel
    Posts
    1,051

    Default How do you set numbering in multi-tenant apps?

    I will soon transform an app to multi-tenant, and i'm puzzled as how to handle numbering of documents.
    For instance, assuming an Invoices table, it currently has an autoinc InvoiceID field. The invoices numbering will increment correctly for this customer.
    Now assuming i add another customer, i need a new InvoiceID count for him. I think i'll have to handle the whole numbering and not set autoinc fields for those. Seems quite tedious, particularly in multiuser environments.
    What do you guys do in your multi-tenant apps?

    Thanks
    Jaime

  2. #2
    Volunteer Moderator
    Real Name
    James A. Talbott, Jr.
    Join Date
    Apr 2000
    Location
    Lexington, KY
    Posts
    1,458

    Default Re: How do you set numbering in multi-tenant apps?

    This is actually quite simple. Create a table with four fields: id (autoincrement, as you would in any table), tenantID (the value you are using to identify each tenant), document type (invoice, purchase order, quote, etc), and now for the magic: Next Number field

    When your tenant starts to create a document, make a call to the table and find out the tenant, the type of document, and the Next Number.
    Insert that Next Number value into the record of the document. Then when the record is saved, increment the Next Number in the record you used to set the number.
    Also, give the tenant access to the records in that table so that they can reset the Next Number (or set the starting Next Number) as they please.

    Jay
    Jay Talbott
    Lexington, KY


  3. #3
    "Certified" Alphaholic
    Real Name
    Jaime Ben David
    Join Date
    Jan 2011
    Location
    Karkur, Israel
    Posts
    1,051

    Default Re: How do you set numbering in multi-tenant apps?

    Thanks Jay
    Funny i didn't think of this method, that's what i used ages ago ( pre y2k ) in Visual Foxpro because we didn't have autoinc fields at the time :-)

Similar Threads

  1. Pre-release Multi-Tenant Connection String
    By Davidk in forum Mobile & Browser Applications
    Replies: 24
    Last Post: 11-20-2018, 02:55 AM
  2. Multi Tenant Auto Increment
    By beau79 in forum Application Server Version 11 - Web/Browser Applications
    Replies: 17
    Last Post: 12-11-2017, 12:45 AM
  3. How to bulid multi Tenant application
    By eduduru in forum Database Design
    Replies: 6
    Last Post: 04-11-2016, 04:37 PM
  4. Develop Messaging System for Multi-Tenant Application
    By DoronF in forum General Questions
    Replies: 4
    Last Post: 01-01-2016, 05:51 PM
  5. Multi-tenant Web app
    By blancolandau in forum Application Server Version 10 - Web/Browser Applications
    Replies: 2
    Last Post: 12-20-2010, 10:49 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •