Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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.

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?

  • Author

I need to have a fresh copy of it for every single year..

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

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

  • Author

Ok, great! thanks a lot! :)

No problem. That's why we are all here...

  • Author

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!

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...

FMP always drops new records at the end of the stack

No, not always - only when the records are unsorted.

Good point. I forgot my unsort step. Thanks for the reminder.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.