0

Script to automatically create and link parent records

I have created a script that looks for records in a table where the reference field to the linked table = null, then creates a suitable parent record and links the two together:

for i in select 'Submission Clips 2' where refSubPkgs = null do
let pkgName := i.'Submission #';
if cnt(select 'Submission Packages2' where 'Submission #' = pkgName) = 0 then
let newRecord := (create 'Submission Packages2');
newRecord.('Submission #' := i.'Submission #')
end;
i.(refSubPkgs := first(select 'Submission Packages2' where 'Submission #' = pkgName))
end

2 replies

null
    • Post Hoc Limited
    • Peter_Amies
    • 4 yrs ago
    • Reported - view

    ARGH!  Hit the wrong button and it posted.  My question was... My script now seems very complicated.  Does this seem like a suitable approach?  Is there a way to simplify this process?

    • Support
    • 4 yrs ago
    • Reported - view

    No. This is simple :-)

    Birger

Content aside

  • 4 yrs agoLast active
  • 2Replies
  • 1113Views