Productos Envios (go To layout at the start) and Productos (highlighted) are two different table occurrences. They may or may not refer to the same data source table.
In either case, Productos Envios and Productos will have two different found sets, sort orders and current records. In order for the correct records to be present for your script to loop through them, you need to use layouts with that refer to the same table occurrence in Show Records From for both performing the find and then looping through the records.
Well, in haste, I changed the related database for the layout, ran the script and DELETED ALL MY PRODUCT RECORDS! OUCH! Fortunately, I had a backup copy and just had to reinput about 7 products that I recently purchased.
After doing so, I updated the scripts that I had fixed via the forum, and ran the Print New Labels script again before making further changes. The odd thing is that it printed labels for all the products (the loop appeared to be working properly) EXCEPT FOR THE FIRST TWO RECORDS in the found set???? I'm really puzzled. I checked the Quantity4Labels fields on all records and they all show the correct numbers. I also checked to see if there was anything else obvious in the first two records to see if it would kick out those records, but didn't see anything unusual.
Can you think of any reason why it would not word for the first two records and for the other 5??
Nothing comes to mind from here. I assume that this is missing when you preview the labels? You confirmed that these records were in the found set when you printed or previewed them?
Correct. There are 7 products in the found set. Only 5 products (with the correct number of repeated labels) show up in the preview of the labels before printing.
I will make another backup and then try with some more dumby data (adding more inventory) and see if I get the same results. I really see no reason why it shouldn't be printing them all. I'll get back with you later. Thanks for the help.
Are these labels arranged two columns and one row of labels is missing? It may be that Filemaker is starting a new page with those labels. Try clicking the book control to see if there is a second page in the preview with these labels. If so, the last row of labels is a pixel or two accross the limit of the printer's maximum print area. (Some printers can't print nearly as close to the bottom edge of the page as they can the sides or top of the page.) You may find that you can adjust the text on the labels layout upwards by just a pixel or two to fix the problem. If there is a footer, in the layout, you can also try deleting it.
The labels are arranged in two columns per label. The preview shows both columns. When there are enough labels, it goes the the next page fine. I have tried several sets in the Junk file, with inconsistent results and no apparent pattern to it. Sometimes it printed all of the sets and at other it didn't print the information from the first record and then at other didn't print the information from the first TWO records.
After the set is "printed" it clears out the Quantity4Labels on the records that show up on the labels, but not the ones that doesn't print. But if I hit the print button again, if finds and prints the SECOND record not printed - clearing its Quantity4Labels. If I hit print again, it runs the script again and gets the FIRST record - clearing its Quantity4Labels. SO... the records not printing are in the original found set, just not getting into the loop for printing. Like I said is it really irratic??
I don't think the records that aren't being printed are part of the found set at the time you print or preview the records. That would be consistent with what you are reporting here where you can "hit print" and then print one or more of the records not printed the first time around. This may be another case where using the debugger to step through the scripts might give you a clue as to why.
I've got to get going on some other things right now. I'll check it out later and see if I can find the problem. I'll try putting a pause in after the found set before printing to see what give there. Thanks for all the input.
Two things I did or discovered.
First, after each Perform Find command, I added a Sort command before Go To First Record.
Second, (and I hope you don't kill me ) is that the Pause Script that I added was after the Go To First Record command. When I got the Pause, I would scroll my mouse to verify records and it just so happened that I left the cursor at records 1 or 2. I discovered that because once I left it at record 4 and another time at the last of 14 records. Guess what? It only spit out a label for that last record. I do think the Sort command helped, but I'm afraid that the problem was programmer error (not in the programming, but in the programmer himself!)
Thanks a million for your patience and help. I'm getting close to the end of the programming required for this project, so hopefully I won't be bugging much more.