I wrote this code 10 or 15 years ago, and it has transferred just fine to successive Panorama updates, but it is not working with Panorama X.
Could someone explain to me why the loop doesn’t work? Thanks so much!!
getscrap “Enter # of groups”
numbergroups = val(clipboard())
getscrap “Enter Group # to start With”
sorternumber = val(clipboard()) -1
sorternumber = sorternumber +1
Select «BunkName» = sorternumber
Field “First Name”
Field “Last Name”
Sequence “1 1”
Field «Weekly Counselor»
OpenForm “Counselor Lists”
Field “First Name”
In Panorama 6 and earlier, the sequence command used a different syntax. Both the start and increment were combined into a single text parameter, separated by a space. For compatibility with older databases, this syntax is still supported.
This is a known bug. The print command does not continue with the code afterward. There is no word on if or when this will be fixed. However, you should be able to use the printtopdf statement, which contrary to it’s name, can actually send multiple documents directly to the printer without a dialog.
Thanks so much, Jim! But the printtopdf statement doesn’t work for me either. I’ve tried just printtopdf alone and "printtopdf " ". It doesn’t print anything. This is so important to us to find a solution. Every Monday morning, we have about 20 minutes to print a mini counselor list for 54 counselors, a camper’s snack sheet for 54 groups, and a medical info sheet for our 54 groups. There is simply no time to print them one at a time. The old Panorama 6 was a god-send to get those done quickly and accurately. We’ve been using Panorama for about 20 years, moving up with each new version.
I tried to download even a demo version of 6 to the computers of new office staff, but none of the suggested steps has worked. So we have only my computer to accomplish the tasks each day. I want them to use the new Panorama X, but if I can’t get this feature of automatically printing 54 unique sets of group information from the weekly database by using the macros, there will be no need to put it on the four other computers in the office.
I can’t imagine we are unique in needing this fantastic auto-print feature.
I think the until statement needs either a number or a formula that resolves to either true or false. You cannot use a variable alone to count the loops. (You may say until 10 to loop 10 times, but saying until varname, where varname contains 10 does not work.) I think you could add a step to reduce numbergroups by 1 each loop and change the until line to until numbergroups=0. With your code, the loop will execute once then stop.
Thanks so much for answering my question. However, I did change the until statement to read until sorternumber = numbergroups and the code checks OK. However, it still doesn’t work. Jim Rea says having a print statement inside a loop is a known bug. He offered “printtopdf” as an alternative to “print”, but it still doesn’t work. This is so frustrating, as we love Panorama, have used it for 20+ years. But just can’t get Panorama X to accomplish the task we so desperately need.
Yay, Gary! Thanks big time! We’re making progress. I was able to print multiple unique groups directly to the printer. Do you know if we can set print scale in that same printer statement. No matter what I set the scale percentage to in the Setup Page, it prints the same size, and for some of the forms, it is too large to get it all on the page.
Everything Tom says is correct, but I would suggest using the new for loop statement in Panorama X. It’s a bit simpler and runs faster (though I’m sure that won’t matter in this case, the other code, especially printing, will take far more time).
sorternumber = val(clipboard())
Clarification – it’s not the loop statement in particular, it’s any code after the print statement. Basically, Panorama X stops running the procedure after the print statement. Fortunately, printtopdf can do the same job better, so it’s not a big problem.
Minor points – I think the opensheet and selectall statements in your code are not needed. Also the field "First Name" right before the print isn’t needed.
Believe it or not, I read thru that right after I received his response. However, for those of us who are semi-computer-literate, it didn’t necessarily fill in all the blanks.
But I thank you, Jim, and all the others who have taken the time to help!!