PDA

View Full Version : changing child records


ABC123

Andy Neufell
09-12-2002, 08:20 AM
We have many databases linked to a main database called componen.dbf. They are all linked by the comp_id field. When I change the comp_id in the main database, all others will lose the linking field value (obviously). My question is: Is there a way to change this field in the master database and then automaticly change it in all of the others so the links are still preserved? I have "taken care" of the main database(I think-see below) but a little lost as to where to go for the next step. I can create a set that links all of them to the main database if it will help.

let new=ui_get_text("enter","type entire component #","","")

if new="" then
end
else

change_begin(db_current())
componen->old_id=(componen->comp_id)
change_end(db_current(),.t.)
card_resynch()


change_begin(db_current())
componen->comp_id=(new)
componen->revchngdat=date()
change_end(db_current(),.t.)
card_resynch()

end if
end

Andy Neufell
09-12-2002, 08:53 AM
a little more... I am able to change all of the records in the other databases using a field rule-post but only the first records in the other databases are changed. I would need all of the matching records to change, not just the first one

Thomas Henkel
09-16-2002, 09:54 AM
Andy,
Are you using "referential Integrity". In your set design, you can turn on/off referential integrity which should insure that all child records with a matching field get changed when the master field gets changed.

Andy Neufell
09-16-2002, 10:06 AM
No, I wasn't. It works very well now though. Keep it simple, I guess. And why not?!

Thank you very much