Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Trying to be a Better Programmer

Featured Replies

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 by Guest

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 by Guest
Corrected spelling. Sorry...

  • Author

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

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. :wink2:

LaRetta

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.