0

Duplicating a main form (without copying any subforms etc)

I want to duplicate a main form without any subforms from a button

I can do and put - 'duplicate(this)' in the button script

trouble is this copes the form completly including and sub forms and aslso seems to bypass a fields that are set to auto generate a sequenced job number and insert todays date etc.

So is ther a version of the above script that will just copy the main form only? and could i then go on to say duplicate(this) but omit x number of fields? and or subfrom by table name etc.

Has anyone done this?

or is it a case that i code the button the long way for every field?

For example :- 

let xCurrRec := Id; (or could i use this here? ie let xCurrRec := this)
let xDesc := 'Product Description';
let xQty := Qty; etc etc

i.(Quotes := xCurrRec);

i.(Desc := xDesc);
i.(Qty := xQty) etc etc 

i'm hoping there is quick way but .....

2replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • When you say main form and subforms, I assume you mean parent record and related child record. When you duplicate the parent record, the child record is probably duplicated because its reference field's "Composition" property is set to "Yes".

     

    However, instead of duplicating a record, you might be better off creating a new record and selectively filling the fields in that record, like this:

     

    let k := Id;
    let r := (select Table1 where Id = k);
    let f1 := field1;
    let f2 := field2;
    let f3 := field3;
    let d := (create Table1);
    d.(field1 := f1);
    d.(field2 := f2);
    d.(field3 := f3)

     

    Note: The "create Table1" shown above creates a new record in Table1. The data from the prior record is then filled to the new record. Hope this helps.

    Like
  • Hi Dean
    Yes Parent and child and composition sey to yes for referencial integrity.

    Yeah though I would hve to do it the long way... I am okay doing that. Just wanted to know iof ther was a sub version of Duplicate ie Duplicate the parent but not the children etc.. :-)

    Like
Like Follow
  • 1 yr agoLast active
  • 2Replies
  • 443Views