copy one record from a table to another table and also and copy/link the existing link to the same client

M

I have a table called “Old Jobs” which has a relationship to “Customers”

So one customer has many old jobs

in old jobs i have put a button to copy a single selected record over to another table called “NewJobs” that is also related “Customers”

in my script below i can copy all the fields needed but also want to copy/rebuild the related link as shown below (Acc Link) so that it stays with the same customer.
(In the image - this is the customer link except visually I renamed it to an alias “Acc Link” on the form)

What add in do i need to make and how?

“Screenshot

 

let xCurrRec := Id;
let xCustID := CustID;
let xJobRef := JobNumber;
let xQty := Qty;
let xDesc := Description;
let xJobDetails := JobDetails;
let xInkColour := InkColour;
let xMaterial := Material;
let xFinishing := Finishing;
let xOther := Other;
let xSupplier := Supplier;
let xTotCost := TotalCost;
let xPrintSell := PrintSell;
let xPrintSell2 := PrintSell2;
let xOrigination := Origination;
let xCarriage := Carriage;
let xZeroVat := ZeroVat;
let i := (create NewJobs);
i.(Qty := xQty);
i.(Desc := xDesc);
i.(“Job Detail” := xJobDetails + xInkColour + xMaterial + xFinishing + xOther);
i.(Supplier := xSupplier + xTotCost);
i.(Sell1 := xPrintSell);
i.(Sell2 := xPrintSell2);
i.(Screens := xOrigination);
i.(Carriage := xCarriage);
i.(“Zero Vat” := xZeroVat)

Ninox Profile

Think you need one more line:

i.(Customer := xCustID)

Steven.

A

If “Acc Link” is the name of the N:1 reference field (your image is not visible), then:

let xAccLink := “Acc Link” ;

i.(“Acc Link” := xAccLink)

M

Thanks guys - Just realised why it was not wroking the one filed on 1 forms was in fact a lookup formulat itself so I was not referenceing it with my script above

Reply