Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Copy a subset of records into a second table


The Digital Man
 Share

Recommended Posts

What I want to do is copy a set of related records from one table (HISTORY) into a second table (CLOSED_HISTORY)

 

Now I know some will say to just mark the records closed but I am going to be stubborn and refuse to do this.

 

I am thinking about exporting the subset of records into an excel file and then re-importing them into the CLOSED_HISTORY table from the excel file. But that seems like a lot of unecessary disk I.O.

 

It just seems like there ought to be a better way of doing it. Can I go to the CLOSED_HISTORY table and import the found records from the HISTORY table? How would I code that? It seems like I could do that in FileMaker 6 when we had seperate files for each table so why couldn't I do the same now? If I can could someone clue me in to how I would code it?

 

I've also considered looping through the subset of HISTORY records and setting several script steps to copy the contents of EACH FIELD from the HISTORY record into the CLOSED_HISTORY record. This seems like a lot of set field statements and there should be an easier way. In my other life writing in FoxPro back in the 1980's before MicroSoft bought them you could COPY a RECORD into a specially defined VARIABLE which copied every individual field into memory. You than executed a copy from that variable into your new record and it copied all the fields into the new record. It was pretty cool. I don't suppose FileMaker Pro has a similar command? One statement copied all the fields in the record to or from the special variable.

 

Alright, as always thank you in advance for your time.

 

Randy

Link to comment
Share on other sites

Randy,

 

I did something like this just last week. And for some reason it was simple but not intuitive for me.

 

In a nutshell; the key is that you don't really have to export anything. What you do is get your source data ready by doing a FIND for the proper records and then switch over to your destination table and then IMPORT the source file. The same .fp7 file that your source records are in. Match up the fields and wah-lah.

 

Please write back if I'm not being clear.

Link to comment
Share on other sites

Keep in mind, when importing from the same file as the destination file, if there's more than one window open of that file, it will import all records from the source table instead of the last found set from that table.

Link to comment
Share on other sites

Thanks Ted & Ender,

 

I agree with you Ted. Its not intuitive to select the file you currently have open and are working in but it does work.

 

Thanks for the sidenote Ender. In my current solution I never have more than just the one main window open. But I will keep this in mind if I ever develop anything with more than one window open.

 

Anyway the good news is that I now have a working script that is indeed doing what I wanted.

 

Thanks again! :)

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

Terms of Use