bob sherman Posted May 2, 2002 Posted May 2, 2002 I have two files. I would like to copy and paste data from three different fields from file A to File B. I have created a script that will copy the contents of one field in file B then open file A. Then I past this data into the file A field. Now I have to manually go back to the file and do it again. Is there a script that will allow me to copy and past three or more fields of data from one file to another. I know I can accomplish this by relating one file to another, but I am looking for an alternative. Thanks
StevenB Posted May 2, 2002 Posted May 2, 2002 If you set up a relation between A and B then you can create three global fields in File B. Use a script to copy the information to the three global fields then go to File A and use Set Field to "copy" the information. HTH
LeCates Posted May 2, 2002 Posted May 2, 2002 Hi Bob, Is there a specific reason to avoid creating the relationship? In most cases it should simplify your solution. There are good reasons to avoid using Copy/Paste. For instance, when you use the clipboard to move data, you will be eliminating anything that is already in the clipboard. Users cannot generally tell that your script is doing that, and if they manually use Copy as well, you will be deleting their data. They may be unpleasantly surprized when they next try to Paste. Good luck!
RussBaker Posted May 3, 2002 Posted May 3, 2002 Bob Weaver provided this answer some time back on how to avoid dumping any user clipboard contents, if you are using copy/paste in scripts. I thought it was pretty neat ! "There are one or two situations where you can't avoid using cut and paste, like when you are setting up a date range for a find operation. In these situations, you can preserve the contents of the clipboard at the beginning of your script, and then restore it when you are done so that the user doesn't lose the prior contents. Here are two scripts that save and restore the clipboard. code: -------------------------------------------------------------------------------- # This sub-script saves the contents of the clipboard. # The clipboard layout contains the fields gClipboard1 and gClipboard2 Go to Layout [Clipboardlayout] Clear [gClipboard1] Clear [gClipboard2] # gClipboard1 is a global text field which will save the clipboard contents if it happens to be text Paste [gClipboard1][select all] # gClipboard2 is a global container field which will store everything else Paste [gClipboard2][select all] Go to Layout [original layout] -------------------------------------------------------------------------------- code: -------------------------------------------------------------------------------- # This sub-script restores the contents of the clipboard. Go to Layout [Clipboardlayout] # Determine whether the saved clipboard data is text or other, and restore accordingly. If [not IsEmpty(gClipboard1)] . Copy [gClipboard1][select all] Else . Copy [gClipboard2][select all] End If Go to Layout [original layout]"
bob sherman Posted May 5, 2002 Author Posted May 5, 2002 Thanks for all you help. I ended up bringing the information over into a portal and creating a script that would copy the information from the related field to in the portal to the field in the primary file. This allowed me to then create a portal in my urchase order that display the data from my primary file.
Recommended Posts
This topic is 8243 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