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 

3 replies

null
    • Mconneen
    • 3 yrs 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.

    • Mel_Charles
    • 3 yrs ago
    • Reported - view

    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

    • Alain.1
    • 3 yrs ago
    • Reported - view

    Thank you l“ll try 👍

Content aside

  • 3 yrs agoLast active
  • 3Replies
  • 416Views