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.

Copying a field and creating a new record

Featured Replies

Hi All,

Since I am new at FM, I am working in a database that I need to get the field and create a new record in another database. I am wonder how can I write the script to copy the firstname, lastname and there is a option that is "Outstanding" or "Returned", copy it one to their related field in a different table.

Any help will be good.

thank you,

php2005

There are several ways this can be done. One way is this -

Create a relationship between the two tables so that no matter what, it's a valid relationship. The easiest way is to create an auto-entered text field that simply holds the value "X" in each table. So, the relationship is matching "X" to "X", which will always be true.

Create two global text fields in the first table.

In your script, use the setfield fuction to set the two new global fields to whatever to the contents of firstname & lastname are in Table A. Then create a new record in Table B. Use the setfield function again to set the fields you need in Table B with the contents of the two new global fields.

I use globals all the time since they contain the same info no matter what record I'm on. I typically use them to shuffle information from one table to another, just like I explained above.

You can also use the copy/paste method, but I've found that this is typically too restricting, especially when copy info from more than one field.

Ahem... there is no need for the relationship. Global fields, in any table, can be accessed from any other table - related or not. So it really doesn't matter where the global field (we only need one at a time) is.

BTW, in version 7 you can define a "x" relationship without the need for any special fields. Just pick any two fields and connect them with the "x" operator.

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.