laker_42 Posted November 5, 2002 Posted November 5, 2002 I have a script that is copying a value from one file and pasting it into another file. It then does a relookup based on the value pasted into the field. When I set this up, it was working flawlessy. Now it is not working. It will not overwrite what is on the clipboard. No matter what record I run the script from it still pastes the same value into the record in the other file. Any idea what might be going on? I didn't know if there was a way to clear the clipboard before coping the field. This way it would guarantee that I am coping the field value from the current record. I appreciate any help you can offer. Thanks, John
Kurt Knippel Posted November 5, 2002 Posted November 5, 2002 Avoid using the clipboard, this is for end users and there is alot of stuff that can affect how the clipboard operates. Use the SetField command instead.
laker_42 Posted November 5, 2002 Author Posted November 5, 2002 I just tried using the SetField command and it is not working. In the file I am trying to copy the value to I used the following command: Set Field["KitCodeKey","KitCodeRequest::KitCodeKey"] and it doesn't set the field to anything. Is there something else I need to do? Thanks, John
laker_42 Posted November 5, 2002 Author Posted November 5, 2002 Can you use the Set Field command to set a field equal to a calculation field? That is what I am trying to do. That may be my problem.
Vaughan Posted November 5, 2002 Posted November 5, 2002 Copy and Paste script steps only work if the current layout (when the steps are performed) has those fields on it. To get it to work reliably you need to script like this <stuff> Freeze Window Go to Layout [layout with copied field on it] Copy [select, field] Go to Layout [original layout] Perform Script [external, the paste script in other file] The paste script needs this... <stuff> Freeze Window Go to Layout [layout with pasted field on it] Paste [select, field] Go to Layout [original layout] <stuff> For Set Field [] to work, the data types of the field and the calculation must be the same. To transfer data between files, I use what I call "global relationships." Create a calculation field in both files -- I call it "cMatch" -- with the calculation = 1 (yes, just type 1). Base the relationship on this cMatch field (let's call it "global"0 in both files and now every record matches every other record. Define a global field in the "related" file (say, gField) and use the Set Field [] script step to set the related global field to whatever you want. Call a script in the relatede file that then uses this global field value. It's reliable and robust.
Ugo DI LUCA Posted November 6, 2002 Posted November 6, 2002 Are you sure the field value you request to copy is on the layout you use. Sorry if this could seem so simple but it happens to me to spend 10 hours with this kind of problems while I were developping the database and constantly modifying the layout.
CobaltSky Posted November 6, 2002 Posted November 6, 2002 Yes. In fact it is not enough for the field to be present on the layout; it also has to be accessible (ie the "Allow entry into field" option must be enabled) or the Copy (or Paste for that matter) command will fail.
laker_42 Posted November 6, 2002 Author Posted November 6, 2002 Thanks guys for the help! I was able to figure it out. What happened was that I deleted the field that I was copying off the layout I was in and put it on another "All field" layout. I never then switched to that layout to copy it from. It is back to working great. Thanks again!!! John
stefangs Posted November 7, 2002 Posted November 7, 2002 really? i often have fields hidden on a layout (as small as you can make them with the text color being the background color) and "Allow entry into field" disabled. has always worked so far. i feel stupid, because you are the expert, but i swear it's working for me.
jim lee Posted November 12, 2002 Posted November 12, 2002 Is there any reason to use copy/paste over Set Field? In my project I used copy/paste a lot. I found it really annoying that, as a user, my clipboard would get erased. That, and every file needed a "script layout" that had all the fields in it so I knew the one I was looking for would be available. For my last rewrite I changed -everything- to set field steps. It seems a lot simpler. -jim lee
Vaughan Posted November 12, 2002 Posted November 12, 2002 Copy/Paste can preserve text formatting (font, size, style) whereas Set Field cannot. I'm not advocating Copy/paste, in fact as a rule I use Set Field unless there is a compelling reason to use something else (like copy/paste or "Insert Calculated Value").
Recommended Posts
This topic is 8116 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