BikeBoy Posted August 6, 2003 Posted August 6, 2003 Hi all, What I'm trying to do is insert a new record immidiately after the record on which my condition is based. The script step "New Record/Request" seems to be appending the new record to the end of the file, then I need to go back to my previous place in the file. It's like this, I have a long column (73 rows) of numbers, like: 1245323 1245342 12453710 etc. The first 6 digits are OK, but based on the last number (3, 2, or 10, etc) I want to create new records, and print the numbers spanning from 1 until the existing number (3, 2, or 10, etc). for instance: 1245323 1245322 -> newly created 1245321 -> newly created 1245342 1245341 -> newly created 12453710 1245379 -> newly created 1245378 -> newly created 1245377 -> newly created 1245376 -> newly created 1245375 -> newly created 1245374 -> newly created 1245373 -> newly created 1245372 -> newly created 1245371 -> newly created etc. I create a global for holding last number and decrementing it, and need to set new record to left(field1, 6) & MyGlobal - 1 until my right(fieldX, 7) = 1 But I loose the place in the file. Any suggestions are very much appreciated, and file is attached for clarification. Thanks NumberPrintouts_TEST.zip
-Queue- Posted August 6, 2003 Posted August 6, 2003 Records sorted by a unique field will create new or duplicate records directly below themselves. Unsorted records will create new/duplicate records at the bottom of the file, i.e. in creation order.
BobWeaver Posted August 7, 2003 Posted August 7, 2003 You will need to have another global field gCurrentRecord to remember what record you are on before you start creating new records. Use a set field step to set it to Status(CurrentRecordNumber). Then create your new records. To get back to original record use a Go to Record[by field value, gCurrentRecord]. You will also have to watch out when your loop reaches the end and encounters the newly created records. It may want to start duplicating the ones that end in 3 or 2. So, when you create a new record, you should immediately omit it.
Helpful Harry Posted August 7, 2003 Posted August 7, 2003 New records are ALWAYS added to the end of the file, that's just the way FileMaker (and most other systems) work. When adding records to a sorted Found Set, the records appear to be added after the currently displayed one, but a quick Unsort will show you that in reality they too are added to the end. This means the one way to keep your records LOOKING like they're in order is to keep them sorted - a labourious process when you've got LOTS of records that keep needing to be resorted ... or a slow old computer. Another way is to continually sort, export, delete and then re-import all the records. The sorted records will be exported in the correct order, so the newly imported records will import in that order too, but again this is a labourious process when you've got a large number of records and/or fields. BobWeaver's approach is probably a good workaround though.
-Queue- Posted August 7, 2003 Posted August 7, 2003 Ah, yes, I didn't quite get what he was saying on the first read-through. Thanks for pointing that out, Harry. However, you don't have to export/import the records to resort them permanently, if you use something like my 'permanently resort records' sample file technique.
BikeBoy Posted August 7, 2003 Author Posted August 7, 2003 Got it, thanks. I got it working in Excel first, now also in FM
Recommended Posts
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