Angel01 Posted May 30, 2011 Posted May 30, 2011 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.
comment Posted May 30, 2011 Posted May 30, 2011 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?
Angel01 Posted May 31, 2011 Author Posted May 31, 2011 I need to have a fresh copy of it for every single year..
Vaughan Posted May 31, 2011 Posted May 31, 2011 Create a related table to hold the <field1> data, along with a Year field. Create a new related record for 2012.
wonfuji Posted May 31, 2011 Posted May 31, 2011 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
Angel01 Posted June 1, 2011 Author Posted June 1, 2011 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!
wonfuji Posted June 1, 2011 Posted June 1, 2011 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...
comment Posted June 1, 2011 Posted June 1, 2011 FMP always drops new records at the end of the stack No, not always - only when the records are unsorted.
wonfuji Posted June 1, 2011 Posted June 1, 2011 Good point. I forgot my unsort step. Thanks for the reminder.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now