Jump to content

How do you DUPLICATE many records between tables?

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

Recommended Posts

Hey everyone,

This question relates to FM7, but I'm sure the solution I'm looking for would work in FM5-6. In FM7, I have 3 tables:

1) PEOPLE (Person ID, gAction, g1) (the g fields are globals)

2) TEMPLATES (Action Type, Description)

3) ACTIONS (Person ID ref, Action Type Copy, Description Copy)

The TEMPLATES (#2) table is a list of events that make up actions:

Wash Car - Get hose, bucket, soap, sponge or towel

Wash Car - Scrub car with soapy water

Wash Car - Rinse car

Make Taco - Get lettuce, tomato, beans, taco shells and chicken

Make Taco - Cook chicken

Make Taco - Chop everything and stuff in taco shell

Grow Chia - Buy Chia pet

Grow Chia - Soak Chia pet

Grow Chia - Cover with seeds

Grow Chia - Wait 8 days

On the PEOPLE table is a pulldown value-list of all "Action Type" fields from TEMPLATES, defining the field "Action Selection Global". Next to it is an "Add Action" button. In this case, the pulldown would list "Wash Car, Make Taco, Grow Chia".

The ACTIONS table is a list of actions people have chosen by pressing the "Add Action" button.

The easiest way I could see to do this (don't laugh!) is to use FM7's new window and window naming schema to shuffle between windows in the following manner:

Open new window using TEMPLATE

Find all records where "TEMPLATE::Action Type = PEOPLE::gAction"

Open new window using ACTIONS

Omit all

Go to TEMPLATE window, first record.


Setfield (PEOPLE::g1, TEMPLATE::Description).

Omit record

Go to ACTIONS window

New Record

Setfield (ACTIONS::Action Type Copy, PEOPLE::gAction)

Setfield (ACTIONS::Description Copy, PEOPLE::Description)

Go to TEMPLATE window

Next record (exit after last)

End Loop

Close both windows

It works great, but it the screen blinks madly, and does so forever if there are many actions to copy in the template.

Can anyone recommend a better way to do this?



p.s. I formatted the script above with spaces and tabs so it looked all nice, but posting parses all that out. Any way to keep tabs in for easier reading?

Link to comment
Share on other sites


Last question first: at least on a Mac, option-space sends a 'hard space' that gets read as if it were a character. It seems to

Link to comment
Share on other sites

Thanks for the answers!

You got it right, when someone grows a Chia they need all four actions. It would be used like a "TO DO" list, just adding groups of actions that could be checked off.

Import.. cool idea, but it leaves files on the users computer (it'd be nice to avoid that). Can you script the deletion of the import file? Also, does export/import work with served databases, or are there glitches because the filepath is different on each users machine?

Link to comment
Share on other sites

I don't see why you need new windows. Go to Layout works, just like in 6. Also, when running Loops, a Freeze Window at the begin, using only Form View layouts (or at least View as Form), makes a tremendous speed difference.

ESpringer is right though that for many records Import is the fastest method. I don't understand what you mean by "leaves files on the users computer." Are you thinking that you have to export the records in order to import?

You can Import from one table to a different table in the same file in 7. Just choose the same file in the dialog and pick a table. You want to be ON a layout in the table you're importing into first. It's weird, yeah, 6 would definitely freak if you tried this (tell you the file is busy).

Link to comment
Share on other sites

This topic is 7098 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.