Jump 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.

Creating a new record in a different table using original data

Featured Replies

Hi all! 

 

First off, I have been using FM Pro for about 15 years.  While I designed basic databases, I never got real deep in.  That changed this past week when I decided to re-design my main DB.  This DB will contain injury records for high school athletes.

 

I have been trying to grasp relationships for the last 4 days, and I must say, its been tough for me to fdully understand them.  I did create a multi layer conditional value lists using a relationship, but I'm not completely sure how I did it though it works.  

 

Now I have a new desire.  I want to be able to create a script button that does the following.  If a specific injury is listed (in this case, a concussion), I want a script button that will create a new record in a separate table, then bring over the name, sport, and injury date to populate the corresponding feilds.  This is where the relaitionship comes into play, but after about 12 hours of trying, I just haven't gotten it done. 

 

I've read through about two dozen different threads on here to try to get the solution, but at this point, I think reading and trying so many have just lead to more confusion.  Any help provided would be greatly appreciated!!! 

 

(BTW, I've tried to remove the permissions, but Guest account has full access as does the user "Bill")

SOAP.zip

Solved by bruceR

Go to solution

Actually, there's no real need for a relationship to accomplish that. You can use variables instead... Basic code from your original layout might be like

 

SetVariable [$injury: Value:OriginalTableOccurrence::Injury]
SetVariable [$name: Value:OriginalTableOccurrence::PlayerName]
etc
GoToLayout["InjuryDetails" (OtherTable)]
New Record/Request
SetField[OtherTable::Injury; $injury]
SetField[OtherTable::PlayerName; $name]
etc
  • Author

Thanks for the response!

 

That would be great and it looks simple enough.  But I imagine I might be running into a version issue as my Scriptmaker does not have the SetVariable option. 

 

I will likely be upgrading to FM12 over the summer when my budget is released, but I'm hoping to get most of the design in before implementing it.

 

Any other ideas?

You can use a global field instead of the Set variable.

  • Author

You can use a global field instead of the Set variable.

Hmmm.  When I change the "name" field to a global global field, the same name appears across all the records.  Unless I'm not doing it right?

I mean to create a global field for this purpose. Call it anything like MyGlobal or something. Then instead of Set Variable, you Set Field MyGlobal.

 

This has been discussed many times in the past. Do this search in Google site: fmforums Set Global Field and it should get you started in the right direction.

  • Author

Thanks Lee!  I've been through the site looking at relationships, but this is the first I've heard that a Global field might work.

 

I guess this should have been in the Scripts forum after all. :idot:

 

Update: LOL, I'm still conpletely lost.  I understand if there was a Set Variable script choice.  That method is simple.  But using a Global Field is really boggling my mind.  Must be an easier way.

  • Author

Thanks for moving the topic, Lee!

 

So I've continued to battle this problem for the last 3 days.  Just can't get it to click.

 

I've read over the Global Field help threads and pages.  It seems to be the most likely solution.  I just can't wrap my fat head around how to use them to accomplish what I want.

 

The worst part is, as I've been working on this one item, I've thought of a few more new tables where this type function would work and really help my overall database. :idot: 

Create a global field in ANY table. Globals can be accessed from anywhere even without a relationship. So just set the global instead of setting the variable and then retrieve the data from the global when you need it, wherever you need it. :-)

  • Author

So what would the script look like?  I've tried some of the following but most won't allow them to be inputted, saying the table cannot be found

 

SetField [$sport: Value:SOAP::MyGlobal]

 

???

SOAP.fp7.zip

user name and passwords

  • Author

user name and passwords

Username is Bill, no password for that file. The guest account also has full access.

  • Solution

"So what would the script look like?  I've tried some of the following but most won't allow them to be inputted, saying the table cannot be found"

 

There is no example in your file of a script where you try to set a field.

 

But now there is.

SOAP.zip

  • Author

Thanks Bruce!!!

 

I guess the biggest thing was I couldn't grasp how the Global field would capture the data and hold it until needed.  I did write a few script calculations that were somewhat similar but always had an error in not finding the correct table.  The biggest thing I see now is also the need to clear the global field after use, which makes complete sense. 

 

Thanks to all for the help!  As Lee hinted at, sometimes a little push in the right direction is HUGE! 

 

I also just found out that I might be able to obtain FM12 from my IT dept a lot sooner than expected, maybe as early as tomorrow.  That will be awesome!

Get the 30 free trial for FMP 12 and get started immediately.

 

BTW the choice to upgrade was a good one. FMP 7 is not only old, it was pretty buggy.

Create an account or sign in to comment

Important Information

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

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.