I have a database that consists of general ledger activity. I want to print a report that shows the balance in each account at the start of the month, the activity for the month and the ending balance, in a table. I can easily create the necessary array and display it quite nicely in a text list. My challenge is how to print it or save the report as a pdf. It is 10 to 15 pages long. The solution I hit upon was to create a temporary database, import the variable containing the array in the temporary database and then print it using a form saved in the main database. Once the report is printed the temporary database is deleted. It works satisfactorily. My question simply is, is there a better way to accomplish the same end? It seems like a bit of a clunky solution.
I can think of a few ways to accomplish that. All involve printing x number of items in the array either on the same page over and over, or the standard method of printing multiple page records.
For multiple pages, use ArrayRange( to break your array into specifically sized pieces and place them on the pages as arrayrange(DataArray,1,30,cr()), arrayrange(DataArray,31,60,cr()),arrayrange(DataArray,61,90,cr()) and so on.
You can predetermine how many pages are needed by the overall size of the array, then use extrapages( to establish it for the orint job.
An alternate would be to use looparray to similarly use arrayrange( to break it down into smaller pieces and as log as the resulting array is not empty, print the same page again with the smaller array set on the page as the one to print.
Kevin, Jim Cook gave one solution, but I like yours better - because it matches temporary with temporary. The temporary grouping and calculations are handled in a temporary database.
Also, nothing is more constant than change. I’m guessing you will have to modify that report from time to time and because it’s in a separate database, you won’t have to mess with the “meat and potatoes” database when monkeying with the report. That independence has value.
But it’s a question of personal style, not right way, wrong way.
So when you say, “better” way, I’m unsure what pros and cons would constitute better or worse.
I was mainly concerned I wasn’t missing some obscure (at least to me) Panorama command that would have simplified this. I considered Jim Cook’s approach but it seemed more, not less, complicated. However we do use it in a different use case.
At a more conceptual level, it is quite intriguing to explore how arrays can replace entire databases. The ability to now easily view the data in them with PanoramaX Text List displays makes working with them much easier for this old guy who grew up on spreadsheets.