Jump to content
Sign in to follow this  
KurtW

Odd Paste() script-step behavior

Recommended Posts

Hi all:

I am using Copy() and Paste() script steps to copy data from one global field to another. For a short while the Paste step would paste whatever old data I had lying around on my clipboard, regardless of what field was Copied. Now it appears to be pasting nothing at all.

I have debug statements placed to show the value inside the global to be copied, and it shows correct data, but how can I (if at all) debug/output what FM has placed on the clipboard with the Copy step while inside a script?

Thanks

Kurt

Share this post


Link to post
Share on other sites

Use Set Field instead of Copy/Paste, unless you are copying and pasting all records. Then this won't even be an issue.

Globals are accessible from any table, regardless of whether a relationship exists between them, as long as there are TOs for them in the relationships graph. So Set Field [table1::global1; table2::global1] will work even when table1 and table2 aren't related.

Share this post


Link to post
Share on other sites

Copy and Paste are also layout-dependent: the target fields must be on the current lauout at the time the steps are invoked, otherwise they fail.

Set Field has no such problem.

Share this post


Link to post
Share on other sites

Hi Vaughan,

Copy and Paste are also layout-dependent: the target fields must be on the current lauout at the time the steps are invoked, otherwise they fail.

To add to this a little. While It is true that your script has to go to a layout where your Copy Field resides to "Copy", and then it a Layout where your Paste Field resides to "Paste", the user doesn't have to watch it do it. All you need to do is to use the Freeze Window Script Step before you start it on its journey.

However, the Set Field is a better way to do this 90% of the time.

HTH

Lee

cool.gif

Share this post


Link to post
Share on other sites

Thanks to you all for your replys.

I am indeed copying from one layout before moving to, and pasting into, another, so that is covered. I didn't know about the 'Freeze Window' command but know I will be using it now!

I normally use Set Field in my scripts but was under the impression that it wouldn't work in Find Mode. I don't know why I thought that but will certainly give it a go.

Thanks

Kurt

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Who Viewed the Topic

    1 member has viewed this topic:
    Lee Smith 
×

Important Information

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