Update all recoords
Hi there
has anyone tried to update all records in a parent table with the link to a child table ?
I have a parent table called members and a child table called photos.
In the child table I have two fields 1. is member number and 2. is image, and in the parent I have several fields where one is the member number corresponding to the same number in child. I have created a form where the parent shows all the fields according to my layout and a linked view to the child table, in this form I have set up a button, which only shows if the image field is empty and by trigger the button it creates the link and the button does disappear. The code in the button formula is this :
let myTable1 := Id;
let myText := Medlemsnr;
for i in (select Foto)[Medlemnr = myText] do
i.(medlemmer := myTable1)
end
and it works perfectly, however I imagine that I could do all the records automatically instead of manually go through the whole database - for example with a global function.
Can anyone help me here ?
rgds
Leo
6 replies
-
Hi Leo
Yes you can create an outer loop to loop through all your members
for j in select members do let myText := j.Medlemsnr; for i in (select Foto)[Medlemnr = myText] do i.(medlemmer := j) end end
Change members to be the name of your members table.
Regards John
-
If your tables are large, you may wish to wrap the whole thing in a do as server
-
Hi Leo
Put the code in a button, and just run it once. It can go anywhere.
Regards John
-
Super it worked perfectly - thank you John
Content aside
- 8 mths agoLast active
- 6Replies
- 73Views
-
2
Following