Newbies Janetc Posted July 6, 2002 Newbies Posted July 6, 2002 I have 1 database (DB1) that stores standard client record information (name,addr,ph,etc.). I have a second related database (DB2) that stores contact history. New contact records in DB2 are created when a user clicks on a button in DB1, which runs a remote script in DB2. The remote script enters browse mode, creates a new record, displays the client name and ID from DB1, and enters the name of the person creating the history record. The problem is that if there aren't already records in DB2, then the script creates TWO records. Single stepping showed that it creates one when it opens DB2 and enters Browse mode, and one when it runs the "Create new record" part of the script. Once a history record exists, then future clicks of the button in DB1 properly create a single new history record in DB2. I hate to create a "dummy" record in DB2 for clients just so I don't get "phantom" records the first time. Any suggestions are appreciated -- or is this happening because I wrote the script while watching a special about Area 51?
LiveOak Posted July 6, 2002 Posted July 6, 2002 See if your relationship from DB1 to DB2 has "allow creation of related records" checked, if so, uncheck it. This is about the only mechanism (except perhaps a startup script in DB2) that would automatically create a related record. -bd P.S. Bob Lazar told me this was the cause!
Geeksharka Posted July 6, 2002 Posted July 6, 2002 Perhaps I am misunderstanding this, but if you're looking to cleanly add a related record (in DB2) to DB1, this works for me (without phantom records). From DB1, launch a script that has only two steps: - Copy DB1 record ID - (run external script in DB2) The external script in DB2 is: - Create new record (in DB2) - Paste DB1 record ID into the related field in the new DB2 record, establishing its relationship back to the original DB1 record. - - - - There are many variations on this general theme, but this simple 'hand-off' from DB1 to DB2 always works. Once you've set the relationship from the new DB2 record back to the original DB1 record, you can set field values in DB2 based on DB1 as needed via script steps, stay in DB2 to finish adding new data to its new record, or in the first script, in DB1, add a thrid step which returns you to the original layout in DB1, and finish adding DB2 data via an already exisiting portal in DB1 of its related DB2 records. HTH
Newbies Janetc Posted July 6, 2002 Author Newbies Posted July 6, 2002 Thanks for the help! Unchecking "Allow creation of related records" worked like a charm. My scripts were almost exactly as Sharka described, but I had selected that one checkbox in the relationships window. I guess I don't really understand the purpose of that checkbox. I thought that ALLOW creation meant that *I* could create related records, not that the system automatically created a record if the related file didn't already have one. Ah, the joys and mysteries of FMP.
Recommended Posts
This topic is 8180 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now