Baylah Posted February 12, 2006 Posted February 12, 2006 (edited) I have been doing a great deal of reading lately as I am am trying to tighten up my programming skills. I know how to do what I am about to ask using a Copy & Paste scenario but I think there must be a more elegant way...And everything I have been reading lately tells me to avoid using Copy & Paste solutions like the plague as they are unprofessional and potentially a user does not want to lose what might already be on their clip board. With that said I have two related tables, one being a contact table the other being an art development information table. IN the art development table when a user enters the company name the "auto fill function" will fill in the name based on the already established value list in the contacts table. If the user DOES NOT GET A HIT on the autofill then they know they must add a record to the contacts table. It is my preference that the user stay out of the contact table (for original records..editing to be done by a supervisor)so what I would like them to do is fill out all of the appropriate info in the art development table and then click a button that will create a new record in contacts and transfer the info via a set field script. Subsequent art development records are auto populated with-look ups generated by the relations on the unique ID created on creation of the new contact record. This is very easy to do with set field, but to use set field I need a portal with a GTTR script assigned to it. (I think) Here in lies the problem. I can't seem to figure out how to get a related record without having the uniue ID already in the contacts table..and to do that I have only been able to figure out a copy and paste solution between tables. I hope this makes sense and that someone can help me out. Like I said, I could program this in 5 minutes using copy and paste but I am trying very hard to improve my technique and better understand how to do things like this. When I look back at some of my older DB's I would be embarresed to have any other FMP developer look at them. While they all work....I have some scripts that are wayyyyyy to long because it was before I really understood set field. Oh my gosh copy - paste, copy paste...... Steve Edited February 12, 2006 by Guest
LaRetta Posted February 12, 2006 Posted February 12, 2006 (edited) Hi Baylah, You can create records automatically in the Contacts table. The same theory of creating related (children) also works in reverse. In your relationship, check 'Allow creation of related' on the CONTACTS side. Then use Set Field [ Contacts:: any field other than the key ; any value ] This will create a new Contact record when none exists which match. But even easier - just place the Contact fields directly on the layout for Users. If the Contact record is blank, they know there is no matching Contact and that, by typing in any field (except the match field), a new Contact will be created. Don't let your Users into the key (match field). FM will automatically insert the correct ID for you. LaRetta Edited February 12, 2006 by Guest Corrected spelling. Sorry...
Baylah Posted February 12, 2006 Author Posted February 12, 2006 Hi Baylah, You can create records automatically in the Contacts table. The same theory of creating related (children) also works in reverse. In your relationship, check 'Allow creation of related' on the CONTACTS side. Then use Set Field [ Contacts:: any field other than the key ; any value ] This will create a new Contact record when none exists which match. But even easier - just place the Contact fields directly on the layout for Users. If the Contact record is blank, they know there is no matching Contact and that, by typing in any field (except the match field), a new Contact will be created. Don't let your Users into the key (match field). FM will automatically insert the correct ID for you. LaRetta You are the best! I knew therer had to be an easy way to do this! You would jsut die if you knew how much time I spent trying to figure this out last night. And i was soooo close...I knew I could do it by allowing creation of a record But I didn;t think to put the field from contacts right onto the art table. Easy as pie. Thanks. Steve
LaRetta Posted February 12, 2006 Posted February 12, 2006 You would just die if you knew how much time I spent trying to figure this out ... It's only during those sweat blood-and-tears nights that we pay the price to TRULY grok it. None of us is *there* yet. That is why we feed each other here. I was fed this concept myself, right here on forums. I've spent 20 hours on a calculation that forums solved in 3 minutes. Oh yes indeed I understand. LaRetta
Recommended Posts
This topic is 6862 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