0

AutoNumber increase when duplicating record

Hi guys,

I have an auto-increasing number field.

"Trigger on new record" :

QNumber := max((select Quotes).QNumber) + 1

Works fine.

I sometimes duplicate a record because I have a set of sub-records that should be the same, initially - (to save myself time)

But when  I duplicate the record - the QNumber stays the same.

is there a way around that?

 

kr. John.

3 replies

null
    • Mel_Charles
    • 1 yr ago
    • Reported - view

    John - Like you I create running numbers in exactly the same way fro my 'jobDockets'. But when it comes to duplicating, the built in duplicate is simply that and exact copy. so I use. button on the form instead to copy fro a bit more control!

    script can be as sample as this ( but I go on to modify the new job date and set orders tatus bck to new etc

    let before := max((select JobDockets).'Job Bag');
    let newRecord := duplicate(this);
    openRecord(newRecord);
    newRecord.('Job Bag' := before + 1)

     

    But I go on to modify the new job date and set orders status back to new etc

    Here is my full script

    let before := max((select JobDockets).'Job Bag');
    let xJob := 'Job Bag';
    let xDate := 'Order Date';
    let newRecord := duplicate(this);
    openRecord(newRecord);
    newRecord.('Job Bag' := before + 1);
    newRecord.(Status := "New Job");
    newRecord.('Won Mailer?' := null);
    newRecord.('Order Ref' := null);
    newRecord.(DispatchBy := null);
    newRecord.(Promised := null);
    newRecord.('Quote Ref' := null);
    newRecord.('Prev Ref' := xJob);
    newRecord.('Prev Date' := xDate);
    newRecord.(Proforma := null);
    newRecord.('Inv Sent' := null);
    newRecord.('Payment Method' := null);
    newRecord.('Date Paid' := null);
    newRecord.('A/w Req?' := null);
    newRecord.('Visual Passed' := null);
    newRecord.('Other Action' := null);
    newRecord.('Sage Inv' := null);
    newRecord.('Order Date' := today());
    newRecord.(AckFlag := null);
    newRecord.(DispFlag := null);
    newRecord.(SupInv := null);
    newRecord.('Dispatched Date' := null);
    newRecord.('Internal Notes / lnvoice Comments' := null);
    delete newRecord.'Purchase Orders';
    delete newRecord.'Delivery Notes'

      • KAXIG ApS
      • John.1
      • 1 yr ago
      • Reported - view

      Mel Charles Thanks a lot - just what I was looking for - I'll copy your method :)

      • Mel_Charles
      • 1 yr ago
      • Reported - view

      John Cool... Could you please mark your post as answered 🙂

Content aside

  • Status Answered
  • 1 yr agoLast active
  • 3Replies
  • 62Views
  • 3 Following