gnarlydude Posted May 21, 2002 Posted May 21, 2002 This is a problem that I run into with almost every data base I create. In my latest database I actually have 2 related databases. The first is "Clients" and is a basic contact manager. The second is "Policies" which holds all the policy information for all my clients (in case you haven't figured it out this is for an insurance agency). In my Client DB I have a button that creates a new policy. The script is supposed to copy the client id, open the policies DB, request a new record, past the client id and based on the id the pertinent demographic data from Client DB is shown in related fields (like last name, first name, etc.). Then back in my Client DB I have a portal that shows each policy a client has in a repeating field. Here is where the problem starts. If I am looking at the layout in my Client DB that shows the policies portal, the policies DB must be open. If I then hit the Create new policy button, instead of opening policies (cause it is already open), copying the client id, etc. the Policies DB just pops up with the record/policy I last created. I then have to manually create a new record and enter the client id. This defeats the whole purpose of my "Create Policy" button and script. Is there a better way to achieve this? Would a look up work better?
Vaughan Posted May 21, 2002 Posted May 21, 2002 Why not just check the "allow creation of related records" in the relationship so that creating new related records is a simple as typing into the blank row at the bottom of the portal? To fix your script (if you still want to do it this way) don't use the Open [] step. Use the Perform Script [] step and call the "Make new related record" script in the related database as an external script. It never fails.
Pupiweb Posted May 21, 2002 Posted May 21, 2002 I'd add a file: you've Clients and Policies; add a ClientPolice file (a so-called join file) in which you'll create a record for any combination of Client and Policy you may have, while the Policies file holds one record per Policy Relate Clients to ClientPolice by ClientID and relate Policies to ClientPolice by PolicyID; in ClientPolice make similar ("reverse") relationships towards Clients and Policies by whcih you can look up client and policy data Create new policies for a client either using the option "allow creation of related records" or with a script like yours (copy clientID, go to ClientPolice, create new record, paste clientID ...) ...
gnarlydude Posted May 21, 2002 Author Posted May 21, 2002 In reply to: Why not just check the "allow creation of related records" in the relationship so that creating new related records is a simple as typing into the blank row at the bottom of the portal? One reason I didn't do it this way was because I'm a newbie and didn't know that I could! The main reason is because each Policy record will contain a lot more info than what would be shown in the portal.
gnarlydude Posted May 21, 2002 Author Posted May 21, 2002 Oh, and thanks to both of you for the info. I will try both and see if I can get it to work.
gnarlydude Posted May 24, 2002 Author Posted May 24, 2002 Yes! Your idea worked Vaughan. Your a genius, thanks a million! This has been bugging me for so long, you have no idea. Joe
Recommended Posts
This topic is 8220 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