Printing Cross Tab Table


#1

How can I print the information displayed in a cross-tab table? The preview and print programs in the menu are dimmed.


#2

Use the Crosstab>Make New Database with Crosstab Data command, then you can print the resulting database. If you don’t need it further, just close it when you are done – you don’t even need to ever save it or give it a name.


#3

I have a form with a text list populated with a crosstab statement. In this case, you may choose “Print One Record” either from the File Menu, or procedurally with the

printonerecord "dialog"

statement. This will print the form, buttons and all.


#4

That’s the other option, however, using a form with a Text List won’t work if the crosstab is longer than one page.


#5

I quickly discovered the one page limitation!!

Is there any way to do the printing programmatically ? I’d really prefer not to have one of the individuals using my program to have to go into the cross tab workshop.


#6

Yes, this could be done. The cross tab workshop is just a Panorama database itself. Everything it does uses publicly documented features of Panorama X, that you can use yourself in your own programming.

The key feature is the crosstab( function. This function analyzes the specified database and creates tab delimited text based on the crosstab specifications you supply.

To print, you’ll need to import this text into a separate database, which can be done with the importtext statement.

Rather than writing this code for you, you can let the crosstab workshop do it for you. Set up the crosstab you want, then use the Crosstab>Make New Database with Crosstab Data command I mentioned earlier. This creates a new, untitled database containing the crosstab data. But this new untitled database also contains two procedures that are already written for you – Select Original Data and Refresh Crosstab. Through these procedures, the crosstab specification is “baked in” to this new database. So my suggestion would be to save this database with it’s own name. Later, you can open that database again, and simply choose Refresh Crosstab to update the crosstab data. You don’t need to open the Crosstab Workshop again, this database is independent (you do need to make sure the original database you are analyzing is open).

If you wanted, you could make a procedure in the original database that opened the crosstab analysis database you have created, refreshed the crosstab, printed it, and then closed it. It would be something like this:

opendatabase "Sales Crosstab"
call "Refresh Crosstab"
printtopdf "Sales Crosstab.pdf"
closefile

One thing to keep in mind is that the fields in this database may change each time you refresh the crosstab. So you shouldn’t generally rely on the field arrangement. This isn’t a problem if you are printing the data sheet, but if you wanted to set up a form for a custom printout, that will be quite difficult because the field arrangement may change. Not impossible, but it would require a custom program to actually generate the form, rather than creating the form by hand. The customreport statement would be helpful for this.


#7

Thank you very much for your helpful advice.


#8

And a very sincere thank you Jim from me as well, especially for taking the time to provide so much detail.


#9

You are both very welcome, I want to see people getting the most out of Panorama X :slight_smile: