Teresa Sampaio Posted April 5, 2006 Posted April 5, 2006 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
mz123 Posted April 5, 2006 Posted April 5, 2006 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.
comment Posted April 5, 2006 Posted April 5, 2006 global fields cannot be accessed in Find Mode Yes, they can.
mz123 Posted April 5, 2006 Posted April 5, 2006 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?
comment Posted April 5, 2006 Posted April 5, 2006 You cannot enter (make active) a global field in Find mode - therefore, you cannot copy its contents either.
xmoose Posted April 5, 2006 Posted April 5, 2006 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.
Teresa Sampaio Posted April 6, 2006 Author Posted April 6, 2006 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) 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
Søren Dyhr Posted April 6, 2006 Posted April 6, 2006 (edited) 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 April 6, 2006 by Guest
Teresa Sampaio Posted April 6, 2006 Author Posted April 6, 2006 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
Recommended Posts
This topic is 6808 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 accountSign in
Already have an account? Sign in here.
Sign In Now