Jump to content

Copy/paste v set field


This topic is 5645 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

This topic is 5645 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Who Viewed the Topic

    2 members have viewed this topic:
    Tim B.  chikanyc 
×
×
  • Create New...

Important Information

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