Jump to content

Copy and Paste a single field between two tables

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

Recommended Posts

  • Newbies

My first post, so be gentle!

He's my issue. I'm trying to get data in a single field from one table to another. I need to move a number from one table into a global number field in another table for a comparison test later in the process.

I've used the Copy and Paste commands with good luck to date, but this time it isn't working. ..mostly. ...sometimes. Sorta. But not really.

I'll explain it in generic terms, but would be happy to go into detail if it will help.

In table A I do a find and start looping through the found set. for each, if data exists in table B, I run the external script (In Table B ) to copy the duration field and paste it into a global number field in Table C. Control then returns to the script in Table A, which copies the ID, and runs a script in Table C to find data relating to the item in A. (Clear as mud, right?)

Once in Table C, I should have a number in the global field (If it exists in Table B for this item) But I don't.

The data exists in Table B. The script in Table C

"Paste [select, "Global Days"] runs, but the number doesn't show up in the global field. (Except for ONE record. And it still doesn't work for that one.)

Is there some way that I can get the content of a field from one table (Table B ) into another table (Table C) so that I can do a test on it for those found items (In C) that relate to the ID of the item in Table A? That's the reason I use the global, to act as a variable.

I'm at wits end here folks! Please! HELP! Anything I can add, I will. Just let me know! I've been beating my head against this problem for two days now!

*imagine a smilie with tufts of hair torn out in frustration*

Link to comment
Share on other sites

Most developers would shy away from using copy/paste to move data around.

The most reliable way of doing this is to set the global field through a relationship between the two tables (Set Field script step)

In FM7/8 no relationship is needed, you can set a global across tables directly.

Link to comment
Share on other sites

You mean this one? :hair: I know it well.

< - - - - They call me baldy now.

I have read this several times. And it makes my head spin. It seems very over-complicated. Part of my problem is that, when people just say A and B and generic stuff, I can't see the solution under it. Simply, I can't put it in context of a real solution. Why don't you relate A to C directly? Any value you need in C can be accessed from A (which will pull the values needed from :P.

You can control the relationship between A and C easily using globals which will be set via your scripts. You can even create new records in C if needed - without ever leaving the comfort of your living room (smile). Can you post a file? We simply need more information here. But I'll tell you ONE thing ... copy/paste is troublesome because the field must reside on the layout when script fires. It can easily break. AND copy/paste pollutes the User clipboard. I don't mind using the clipboard if the USER fires the script - something they wish to do. But I don't want to use clipboard otherwise.

Fill us in and we'll assist as best we can. There are many here to help you. But be prepared to do some leg-work to clearly present your situation. Otherwise, advice is just like data - garbage in; garbage out. :wink2:

UPDATE: It seems I can't type capital B with a parenthesis after it or it turns it into the grey face. That is supposed to say file/table B. :crazy2:

Hi there, Wim! :P^)


Link to comment
Share on other sites

If you're setting a global in the other file then you don't need to create a new relationship for that, you can use any existing relationship between the two files, even it that relationship does not make sense (is invalid) for the particular record you're on.

This doesn't work for normal data, but for globals it doesn't matter.

Link to comment
Share on other sites

This topic is 5672 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

  • Create New...

Important Information

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