May 30, 201114 yr 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.
May 30, 201114 yr 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?
May 31, 201114 yr Create a related table to hold the <field1> data, along with a Year field. Create a new related record for 2012.
May 31, 201114 yr 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
June 1, 201114 yr 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!
June 1, 201114 yr 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...
June 1, 201114 yr FMP always drops new records at the end of the stack No, not always - only when the records are unsorted.
Create an account or sign in to comment