Output 5 (Label view) [message #7574] |
Sat, 20 February 2021 06:05 |
htManager
Messages: 431 Registered: May 2014
|
Senior Member |
|
|
Hi Tony,
I would like your advice for the following problem:
I want to print admission tickets and I thought that an output5 pattern would be best for this. But after I read your code in the _cm_post_fetchRow() in the x_option_s01.class.inc I am not sure if I can generate my output in the way I want. I attached an output example of my old application, written in Paradox ObjectPal.
In contrast to the x_option table where the x_option table holds all occurences, my table structure has one row with the two fields start_no (1) and end_no (80) to determine the ticket numbers to get printed. Do I have to create a virtual table with all these numbers as rows? If yes, where would I place this code best?
I want to add images like the logo of a sports club on the tickets. Is this possible?
Or would you recommend to use a different output pattern perhaps with individuel page settings? At the moment I use a DIN A4 format and there are 8 tickets on it.
|
|
|
Re: Output 5 (Label view) [message #7575 is a reply to message #7574] |
Sun, 21 February 2021 04:28 |
AJM
Messages: 2363 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
The OUTPUT2 pattern prints multiple rows on a single page, one line per row.
The OUTPUT3 pattern prints one row per page.
The OUTPUT5 pattern prints multiple rows on a single page, one block of text per row.
The OUTPUT5 pattern can print 8 rows of data per page, in 4 rows of 2, in the format shown in your document, so that is the right pattern to use. You need to try it out and see what results you get, then get back to me if you have any problems.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: Output 5 (Label view) [message #7577 is a reply to message #7576] |
Tue, 23 February 2021 04:24 |
AJM
Messages: 2363 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
I do not understand why you say that this pattern will only print one record. When the $object->getData_serial($where) method is called on a table object then it will return the number of records which satisfy the $where clause. If you are storing the quantity of tickets in one record then only returning that one record then your approach is wrong. The call to ->getData_serial() will return the number of records, then subsequent calls to ->fetchRow() will return one record at a time.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
[Updated on: Tue, 23 February 2021 04:25] Report message to a moderator
|
|
|
|
Re: Output 5 (Label view) [message #7579 is a reply to message #7578] |
Wed, 24 February 2021 04:35 |
AJM
Messages: 2363 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
Although you would normally perform the ->getData_serial() method on the table object which contains multiple tickets, if you are saying that the tickets do not actually exist as rows in a table but are generated "on the fly", then a different approach is needed. After the call to ->getData_serial(), which returns a resource, the framework will then obtain records one at a time by calling $resource->fetchRow(), which will either return another row or it will return FALSE to signify EOF. Note that it is possible in your _cm_fetchRow() method to construct another row manually, so although the ->getData_serial() only reads a single record you can call ->fetchRow() as many times as you like, and the processing will only stop when ->fetchRow() returns FALSE.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: Output 5 (Label view) [message #7581 is a reply to message #7580] |
Thu, 25 February 2021 05:59 |
AJM
Messages: 2363 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
Sorry, I did mean _cm_post_fetchRow(). You do not have to call ->fetchRow() yourself as that is done automatically within the PDF object when the following line of code in std.output5.inc is called:
$document = $pdf->outputPDF_LabelView($resource);
This will keep calling ->fetchRow() and ->_cm_post_fetchRow() until it returns FALSE which signifies EOF.
I have just checked the code and seen that after retrieving the first record with the first call to ->fetchRow() you need to set $this->skip_getdata=TRUE so that it skips subsequent database reads and goes straight into _cm_post_fetchRow().
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
[Updated on: Thu, 25 February 2021 06:00] Report message to a moderator
|
|
|
|
|
|
|
|