Mountain Biker Two Posted June 7, 2003 Posted June 7, 2003 I want to have a script that will create a new record in a related database and put the ID in the ID field. I tried Copy Record Open ("RelatedDatabase") New Record/Request but this creates a new record in the database I'm in. And the RelatedDatabase flickers on the screen suggesting that somehow the script is touching it. BTW this will not be the only file in the RelatedDatabase with this ID. I'm storing multiple notes about the ID in the RelatedDatabase. The information shows up in the main database through a portal. I got this working (and it seems more complicated than what I want to do, but then it's not scripting). Can't be that hard. Seems like a natural thing to do. Book by Schwartz didn't help me either This has probably been answered somewhere, but although I've used FM for years, I am only scratching the surface. I wrote scripts attached to buttons to take me from the RelatedDatabase back to the main one, so have some of this figured out, but I've never tried to move data from one field to another escept of course by calculation. Thanks
Anatoli Posted June 7, 2003 Posted June 7, 2003 RE: Copy Record Open ("RelatedDatabase") New Record/Request but this creates a new record in the database I'm in. Naturally. Your script is running in first database and it just open the second, related db. Then it created new record in first db, where script is executing. Move the New Record/Request into related db and call that script instead of Open ("RelatedDatabase")
Mountain Biker Two Posted June 9, 2003 Author Posted June 9, 2003 Thank you. I knew it would be easy. Just too much of a newbie to think about it right. But I still don't have it. How does the script know which record I was in, since I want the IDs to be the same? I tried copy record, but don't see any other commands that make sense. The script now does create the new record in the correct file. Thanks again for any help.
ernst Posted June 9, 2003 Posted June 9, 2003 Hey Mountainbiker, There are numerous ways to achieve what you want to do, so I'll justtry to explain one... I'm assuming you already have a relation between the two databases. ? create a global field that will hold the ID. Call it something like gID. ? create a script in the database that you want the new record to be created in. The script should do something like: New Record Set ID, gID ? create a script in the main database with the following steps: set gID, ID perform script ( external script, script made in previous step) refresh windwow Last step is to get you back to your main, calling database. Hope this helps, Keep biking! Ernst.
Ugo DI LUCA Posted June 9, 2003 Posted June 9, 2003 Hi, The easiest method. Turn your relationship to allow creation of related records. Then, simply enter the notes you want to create in the new portal row. The ID will instantly be populated in the related file. Now Ernst method would be OK. As you said "newbie", read second script from Ernst as Set ID, :g_ID. "::" is the sign for your relationship !
Mountain Biker Two Posted June 9, 2003 Author Posted June 9, 2003 Thank you both Ernst and Anatoli I learned from both of you. But I think I'll stay with simple. I just deleted my message asking for more help. I wanted a list from the related database to appear in the main database for data entry. I just figured it out. The key was to use popup menu in the item in the portal. Thanks to both of you for your help.
ScottC Posted July 17, 2003 Posted July 17, 2003 I am interested in doing this the hard way, so I'm looking for some hints. Script in related database New Record Set ID, ::gID Script in the main database with the following steps: set gID, ID perform script ( external script, script made in previous step) I've tried the two scripts and they work to a point. I get the new record in the related database, but the ID number is not added. Does the script stop at the create new record? I've tried adding a resume button to resume the script and add the ID after the user inputs the record information but that does not seem to do anything. Help.
ScottC Posted July 18, 2003 Posted July 18, 2003 Duh, thanks kenneth. I put the "g" in front of the variable, but forgot to make it global! It's always in the details. Scott
Recommended Posts
This topic is 7803 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