Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Hi guys/gals,

I have a question, assuming that i have a layout which is like employee database and stores something in lets say Field 1.

It works fine, but lets say now it is year 2011.

How do i duplicate the employee database and let the field 1 to be New?

I know it can be done manually, but i was wondering i could make a script where i just click a button, and the entire database is duplicated and the field 1 is empty again.

Thank you.

Hope to hear from you soon.

Posted

lets say now it is year 2011.

It is year 2011 now - isn't it?

How do i duplicate the employee database and let the field 1 to be New?

Why would you want to do that?

Posted

Create a related table to hold the <field1> data, along with a Year field. Create a new related record for 2012.

Posted

Hi

Not sure I follow all your logic but a nice way of duplicating all records of a table is like this pseudo code:

Go to layout (Employees)

Show All Records

Loop

Go to Record Last

Duplicate record

Set Field 1 = ""

Omit Record

Omit Record

ExitLoop if found count = 0

End Loop

Posted

Just a short question,

I am wondering what is the Omit record for?

and also can you explain the logics behind the exit loop if found count=0?

I mean, thinking from my perspective, Foundcount is the number of records right? so, how is the number of records ever 0?

Please explain.

Thank you!

Posted

Well...

You find all records

You go to the last one

You duplicate it and adjust any values you need to.

The record you duplicated and the duplicated one will be the last two records in the group (barring some weird sorting)

the double OMIT will hide the new record plus its origin record

you keep looping until the final pair

you omit both

found count= 0

and the loop ends

often, it seems, it is easier to go backwards as it "honors the threat" - the problem you encounter when going to first record, duplicating it, then having to go first , omit that one, go last and adjust it, omit that one, go back to first etc.

ie. FMP always drops new records at the end of the stack - so you may as well work from that end - took me 18 years to get a grip on that logic - now it is habit.

I suspect I am rambling as the sun has set quite a bit...

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