0

how to add auto numbering

How do I add auto numbering to records on creation please.

5 replies

null
    • PAGE
    • Bill_Page
    • 3 yrs ago
    • Reported - view

    Emphasis, I have tried from information on other threads but still no good as I am getting increments of 10 based on System ID number. 

    • PAGE
    • Bill_Page
    • 3 yrs ago
    • Reported - view

    See formula on creation of record in table Customer Data (I only have one table for now)

    'Customer ID' := max((select 'Customer Data').'Customer ID') + 1

    Screen Shot 2020-06-09 at 14.24.54

    It is incrementing by 10 and not keeping the GP-00

    Thanks in advance

    • PAGE
    • Bill_Page
    • 3 yrs ago
    • Reported - view

    OK - Changed Customer ID from Text to Number field and now it works. 

    Just have to work out how to add the suffix GP-00 before each number now :)

    • Nick
    • 3 yrs ago
    • Reported - view

    In order to have the GP-xxx format, the field must be Text.

    Then put this code in the Trigger after create (table level)

    ---

    let prefix := "GP";
    let count := cnt(select 'Customer Data');
    'Customer Number' := prefix + "-" + format(count, "000")

    ---

    • Nick
    • 3 yrs ago
    • Reported - view

    ...and remember if you duplicate a record this trigger will NOT fire :-(

Content aside

  • 3 yrs agoLast active
  • 5Replies
  • 1410Views