I have a report with a narrow 2" detail band. The report prints four across then goes to the next row. I’m printing from a queue. How do I sort the queue so that I get my entries sorted alphabetically by column, like this?
A E I L
B F J M
C G K N
D H
If you’re still using CRT take a look at Columnar Report.
If you were using RPM I’d say take a look at Newspaper Column report.
I would leave the Queue sorted Alpha and instead do some math to find each column. Something like below:
QRecs = Records(Q) !example A-N = 14
RowCnt = Int( ( QRecs - 1 ) / 4 ) + 1 ! = 13/4+1 =4
Loop RowNo = 1 to RowCnt
Loop ColNo = 1 to 4
QPtr = RowNo + (ColNo-1)*RowCnt
If QPtr > QRecs Then Cycle.
Get(Q,QPtr) !or check If Error Cycle
Print
Done on my phone on vacation so not sure my math is right but hope you see the logic.
Another way is to use an Array to load your queue into, then print using the array
Use Lee’s products the work is already done for you.
What do you do on a page break? Does your listing continue down the same column on the subsequent page or is each page a cell of data?
If it is a cell of data you just need to know how many rows of data fit on the page. If it is say 10 rows then you know that you will need 40 records per page.
So you can sort your data alphabetically and assign each record a row and column number, then you can sort your queue by row and column and print in that order. If it’s more than one page you will also need a page number in your queue.
(The devil is in the detail though, so see my first suggestion if it’s too hard!)