Print a report?

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
Posts: 219
Joined: Wed Jun 21, 2006 7:33 pm
Location: West of the Pecos

Print a report?

Post by rumplestiltskin » Sun Aug 17, 2014 11:19 pm

I have a stack that I'm using like a database. Each card contains one record's worth of information (16 fields). The user will add more cards or delete cards as necessary so I don't know a specific number of cards (but I know there wouldn't be more than a hundred or so). Periodically, the user will want to print a report that would essentially be a "datasheet" or "spreadsheet" view of all records with a header at the top of the page displaying all the field labels. I have a rough idea of the number of characters that will be in each field (and I can, if necessary, enforce this with scripts).

What do you think the easiest solution to this problem? I was thinking I might create a sub-stack with one card of about 8.5"x11" and one field on that card; then, when the user clicked the "Print Report" button, I'd have a handler that would travel through all the cards of the stack and add the contents of the fields into a variable (with a "return" at the end of the last field in each card). Finally, I'd open the sub-stack, put the contents of the variable into the field, and print the card. Of course, formatting the text in the field so everything lines up is the trick.

Suggestions are always welcomed.


VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 708
Joined: Fri Jun 27, 2008 9:00 pm

Re: Print a report?

Post by Mikey » Mon Aug 18, 2014 2:57 pm

Howdy, Barry,

There are several options to choose from, with varioius levels of complexity. None are easy the way we wish they would be, but all work:
1) You can go your route. If you do, use a monospaced font so that you can line everything up.
2) Variation on your idea, where you have a card that is the format for the report, and you populate the fields with the values you want (if you're printing a grid, there is the datagrid tool or the "Basic table field" tool).
3) Try Quartam Reports, a LC plugin that might make your life easier.
4) Crank out HTML, instead, and print that.

VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5344
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN

Re: Print a report?

Post by jacque » Mon Aug 18, 2014 5:52 pm

Just a comment about stacks used as simple databases: I've converted lots of old HyperCard stacks that do that and haven't seen any significant problems with stacks containing 5,000 cards or more, even when there are dozens of fields in the main background. So I wouldn't worry about your current setup.

The main issue would be with available RAM if there is a lot of data over thousands of cards, and a slowdown in the find command if you're using that. One hundred cards is insignificant.

For your main question, I use Mikey's second suggestion. If the content overflows the height of the printing field, use the pageheights function to determine how much text to put into the field, print the card, and repeat until all the text has been printed.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software |

Post Reply

Return to “Mac OS”