Old Code from Panorama 6 not working

																																																					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!!

local sorternumber
local weeknumber
local numbergroups
local counselornumber
getscrap “Enter # of groups”
numbergroups = val(clipboard())
getscrap “Enter Group # to start With”
sorternumber = val(clipboard()) -1
sorternumber = sorternumber +1
Field “BunkName”
Select «BunkName» = sorternumber
Field “First Name”
Field “Last Name”
Field “Number”
Sequence “1 1”
Field «BunkName»
Fill sorternumber
Field «Weekly Counselor»
OpenForm “Counselor Lists”
Field “First Name”
until numbergroups

The Print command needs a parameter. Either “” or the word dialog.

When I had Print Dialog, it still would not let me print more than one time. It would not automatically go into the next bunk group when I hit Print again. On one attempt it said “numbergroup” invalid

Should there be a comma in the Sequence “1 1” statement instead of a space?

Should it be: Sequence “1,1”?

Legacy Syntax

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.

Thanks, Bakkum, but the sequencing works just fine. It’s just the loop function that’s not working.

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.

Glenda K

Camp Thurman

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.

Hi Glenda, I am sure that PanX can printtoPDF inside a loop and have a procedure that does exactly that, which has been in use for at least two years.
Maybe you could post your revised code?

Using printtopdf “” will actually print a pdf file with the name of the database. To actually print to your default printer use:

printtopdf "","Printer"

Thanks so much. I tried, and it says Printtopdf error (value of PRINTER option is missing)

Glenda K

My mistake, it should read:

printtopdf "","Printer",""

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())
for sorternumber,sorternumber,sorternumber+numberofgroups-1

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.

Yes you can - this will scale the output to 50%:

printtopdf "","Printer","","scale",0.5

When you have time, go over the Panorama Help file for the printtopfd statement as Jim recommended earlier.

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!!

I believe I am on my way to making it work.