Inserting User-Defined Number of Records
Is there any way to add a user-defined number of new records? Here's my issue:
I'm often printing client address labels. However, most of the time, I only need to print a few records at a time, not every record in the database. I'm trying to solve what happens with a partially used sheet of labels. Let's say on Tuesday, I print two labels from a new 10up sheet. On Thursday, I want to print 1 new label on the same sheet (let's assume that I can't flip the sheet over in this scenario -- only because that solves the issue once). By adding new records, I can begin where the sheet would naturally have printed labels, but the new records are empty and therefore nothing prints in those slots. In the past, Ive always added and deleted these new dummy records by hand. As you can imagine this can be rather tedious and prone to error. I've figured out most of the script steps to solve this dilemma, but the one I can't seem to account for is how many new records to add. In a perfect script, this would change every time I wanted to print because there would be a different number of missing labels on each used sheet. I've thought about going the end route around it and make new scripts or layouts to account for the shifting number of records, but it seems Filemaker should be smarter than that.
Would this require a "loop-end loop" series? A custom dialogue box?
It does require a loop. Each time around, the looping code creates a new blank record for you.
Let's say you have the needed number of blank records already stored in a variable: $NumbRecords. (You can also use a global field for this.)
Exit Loop if [$I > $NumbRecords]
Set Variable [$I ; Value: $I + 1 ]