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 v set field

Featured Replies

Hi

I saw post # 172831 (Copy Paste problems) and I would like someone to explain to me how can I replace the Copy/Paste solution for Set field[] - which I think is suggested. In my (very humble) opinion, this would only work if the paste data was specific data…

I have a lot of scripts using the copy/paste solution, so if this isn’t the best way to do it, I would be grateful if someone could tell me what to use instead.

Thanks in advance

Teresa

For copy and paste, the fields must be on the layout you are on.

For set field, the field is not required to be on the layout. Set fields are very useful especially when filling global fields among other things.

If you can give me an example of a copy and paste I can try to help you further.

In my work, I use copy and paste when I am doing finds that use specific data (things in global fields for example, since global fields cannot be accessed in Find Mode) but set field is much cleaner since it doesn't require the clipboard or the fields to be on the layout.

global fields cannot be accessed in Find Mode

Yes, they can.

Sorry you're right.

You cannot copy a global field while in Find mode, but you can set a field to the value of a global field in Find mode.

Right, comment?

You cannot enter (make active) a global field in Find mode - therefore, you cannot copy its contents either.

I find that, in older scripts where I used "copy and paste" (before I knew how to use "Set"), Windows will sometimes "drop" what it has on the clipboard. I'm not sure whether it happens on the copy or the paste, but every once in a while, it just doesn't work.

Leave the clipboard out of it if possible.

If the layout you're in contains the table with the original data and the destination field, it's fairly straight-forward.

SetField (Table1::Field A; Table1::Field B ) sets field A to what you have in field B.

If the fields are in different tables and the record with the good data has a one-to-one relationship to the record where the data needs to go, you can push it through.

SetField (Table1::FieldA; Table2::Field B )

Otherwise, you get into setting globals or variables to move the data around.

But, definitely, I'd avoid the clipboard if possible.

  • Author

Sorry, but I still don’t understand how can I replace copy/paste with Set field, in cases like this one (most of my cases are like this or worst… when changing data between files I have to put a copy script in the first one and the paste script in the other – I know this may by a little unprofessional but is the only way I know):D

Copy [select, "field A")

Enter find mode []

Go to field ["Field A"]

Paste [setect, "Field A"]

Perform find []

Sort [no dialog]

if [xxxx]

Go to Layout ["yyyy"]

End if

Thanks for your help.

Teresa

Hows about:

Set Field[g_Temp;fieldA]

Enter Find Mode

Set Field[fieldA;g_Temp]

Perform Find

Sort [no dialog]

if [xxxx]

Go to Layout ["yyyy"]

End if

...would I say! After having fm5 out for a spin - today would $variables be a better bet, since it doesn't litter the base with auxillaryfields. Then is there the question of passing between files, since we're talking fm5 and not 2.1 should you interconnect the bases with a relation say a constant aka a calcfield which equals 1 in both files and tie them together with the relationships.

--sd

Edited by Guest

  • Author

Thank you, MMS6F, comment and jsalzer, for your tips.

Thank you SD, for making it a litle bit clear!

I'm assuming that the "g_temp" is a global text field, to be created, with the "fieldA" pasted in it - hope I'm right, because it works!

Teresa

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.