0

Automatic incrémentation

hello, is it possible to increment a counter after creating a new record?
example: automatic incrementation of an invoice number when creating another

thank you

Alain 

3replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
    • Mconneen
    • Mconneen
    • 1 yr ago
    • Reported - view

    @Alain

    Yes.. I would put the logic in the “Trigger on Create” ...   Here is an example.. I have a Statement of Work (SOW).. and each SOW can have many amendments .. which go in sequential order... So I put the following in the Amendment (Details) Trigger on Create ..

    let t := this;
    t.(Amendment := max((select Details)[number(SOWS.Id) = number(t.SOWS.Id)].Amendment) + 1)

     

    You can use something similar for your Invoices .. or Invoice Line Items tables.

    Like
  • Alain

    This is how I do it (again on trigger on create)

    let before := max((select JobDockets).“Job Bag”);
    “Job Bag” := before + 1

    mine is for a job bag number but ideal is the same

    Mel

    Like
    • Alain
    • Alain.1
    • 1 yr ago
    • Reported - view

    Thank you l“ll try 👍

    Like
Like Follow
  • 1 yr agoLast active
  • 3Replies
  • 378Views