adding many record references
Is there a way to update multiple references at one time when linking two tables? I have thousands of records and it would take too long to go through them one by one.
6 replies
-
Hi Tom -
Maybe you can give us some background first. What are the two table names? What field in tableA is now being converted to a reference field to tableB? Then we can mock something up.
-
Lovely progression to some succinct code Sean
for oneRec in select OneTable do
for manyRec in select ManyTable where Text = oneRec.Text do
manyRec.(OneTable := oneRec.Id)
end
endDare I say it could even be written as
for oneRec in select OneTable do
for manyRec in select ManyTable where Text = oneRec.Text
manyRec.(OneTable := oneRec.Id)
endRegards John
-
Thank you John.
Yes, one can and the formula editor will add the missing "do" and "end"
Regards Sean
-
Ah Sean you are right I took it from the manual which gives the example
for p in (select Person)
p.Haircolor := "red"and thought there were two forms, one that looped through one by one and another that did a bulk update but would this do it?
for oneRec in select OneTable do
let manyRec := select ManyTable where Text = oneRec.Text
manyRec.(OneTable := oneRec.Id)
endRegards John
-
Yes John, it works in my testing. Nicely done! Now the code is even more succinct.
Regards Sean
Content aside
- 3 yrs agoLast active
- 6Replies
- 674Views