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.

Copy & Paste vs. ????

Featured Replies

FMP8A on Windows XP

There's probably an answer to this somewhere on the forum, but I've looked and can't find it.

Problem: I'm trying to copy and paste four fields from an existing record in table "A" to a new record in (unrelated)table "B" via a script. Copy and paste seems to work fine but I'm wondering if there is a more elegant/appropriate method that would achieve the same results? I experimented with Set Field but I guess I don't know enough about it. :confused: TIA LM

If the tables are truly unrelated, you might want to use script variables. Something like:

Set Variable [$$First; Value:TableA::Field1]

Set Variable [$$Second; Value:TableA::Field2]

Set Variable [$$Third; Value:TableA::Field3]

Set Variable [$$Fourth; Value:TableA::Field4]

Set Field [TableB::Field1; $$First]

Set Field [TableB::Field2; $$Second]

Set Field [TableB::Field3; $$Third]

Set Field [TableB::Field4; $$Fourth]

Edited by Guest
Made variables global

When you use set field script you should have a global field. or a vriable

Script colud be like this

set filed [TableA::Filed; global field]

Got lay out

set field [table B::field; global field

Go to layout[original]

Edited by Guest

Get to know the Set Field command. It is one of the most commonly used commands in the world of FM. I would bet that most experienced developers rarely if ever use copy/cut and paste. I hardly ever find a reason to use it myself.

Edited by Guest

Perhaps Ted it would make more sense if you told why developers avoid it?

The reason is that Copy/Paste should be reserved for inter applicational movements of data, while the avarage scripts hardly ever falls in that category.

Worstcase scenario is the user having stored something to paste later, the script will then make it evaporate into thin air by overwriting.

I regard it as a bad developer habit to use copy/paste at all in scripts. If the user might grap something for other applications should it be done deliberately by hand!

--sd

If you have FM8, K1200's method is good, but if you're doing the whole process in one script, use script variables, not globals. (I.e. use $, not $$.) Script variables disappear once your script is done, which means one less thing to have to manage.

Also note that if you're moving data from one file to another, global variables won't help, as they are file-specific.

At any rate, LM is using FM7, so he can't use variables. But as sherif pointed out, you can do the same thing using global fields instead of $$First, $$Second etc.

Edited by Guest
Oops... I just noticed that your profile says FM7 but your question was using FM8, so yes, variables would work just fine.

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.