Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Framework » Output 5 (Label view)
Output 5 (Label view) [message #7574] Sat, 20 February 2021 06:05 Go to next message
htManager is currently offline  htManager
Messages: 434
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 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2368
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.


Re: Output 5 (Label view) [message #7576 is a reply to message #7575] Mon, 22 February 2021 11:17 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 434
Registered: May 2014
Senior Member
You are right. The OUTPUT5 pattern is the right pattern. I can arrange the fields in the way I want (after some "experimenting").

But I still have the problem to find a convenient way to increase the number of records to be printed. I store the quantity of the tickets in one record (ticket_no_start, ticket_no_end) and at the moment only this record is printed.
I think a possibility would be to make an intermediate step with an add5 pattern where all the occurences could be stored in a temporary table. But I would prefer a solution without this step.

The object calls for an output5 pattern are: initialise(), getExtraData(), getData_Serial() and outputPDF_LabelView(). Can I store the code in one of the _cm_-methods? Or can you tell me a method how to achieve this in a better way?
Re: Output 5 (Label view) [message #7577 is a reply to message #7576] Tue, 23 February 2021 04:24 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2368
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.

[Updated on: Tue, 23 February 2021 04:25]

Report message to a moderator

Re: Output 5 (Label view) [message #7578 is a reply to message #7577] Tue, 23 February 2021 16:01 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 434
Registered: May 2014
Senior Member
Yes, that is all right what you say. In my Paradox application (PC based) I can print all tickets between start_no and end_no by generating the quantity of tickets with code in a method. And my approach was that I could do the same in Radicore.

I think that I expressed myself wrong. I store the start_no and the end_no in one record. At the moment this is the (one and only) record which is printed. Everything is correct!

What I am searching for is a (the) place/method where I can store the code best to increase the table with all the records from start_no til end_no (e. g. 400 tickets from number 1 til 400). After the table has the right quantity of records the $object->getData_serial($where) will be working with all these (expanded) records. I hope that I could express myself a little bit better/clearer now.
Re: Output 5 (Label view) [message #7579 is a reply to message #7578] Wed, 24 February 2021 04:35 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2368
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.

Re: Output 5 (Label view) [message #7580 is a reply to message #7579] Wed, 24 February 2021 09:57 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 434
Registered: May 2014
Senior Member
Thank you. This seems to be exactly the approach I was looking for.

You wrote that I can do this in _cm_fetchRow(). I use V 2.18.1 but in the std.table.class.inc there isn't such a method. Only _cm_post_fetchRow(). Do you meant this one? If yes, how exactly do I have to call ->fetchRow()? I tried it with $this->fetchRow($resource) but nothing happened.
Re: Output 5 (Label view) [message #7581 is a reply to message #7580] Thu, 25 February 2021 05:59 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2368
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().


[Updated on: Thu, 25 February 2021 06:00]

Report message to a moderator

Re: Output 5 (Label view) [message #7582 is a reply to message #7581] Fri, 26 February 2021 07:19 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 434
Registered: May 2014
Senior Member
Thank you once more for your patience! But I still have two problems:

1. If I create an output5 pattern with RADicore, in the output5.php file the controller std.output3.inc is called. In your x_option(output5)labels2.php the std.output5.inc page controller will be called.
With the std.output3.inc page controller the jpg logo-files will be shown as images in the pdf with %%1_vereine_logo, in the std.output5.inc page controller not.

2. I do not know where I can place the code to call the ->_cm_pots_fetchRow() method again? Do I have to do this with a for statement, embedding the code inside?
Re: Output 5 (Label view) [message #7583 is a reply to message #7582] Sat, 27 February 2021 03:31 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2368
Registered: April 2006
Location: Surrey, UK
Senior Member
That's a mistake Sad The output5.php file in the 'default' directory should reference std.output5.inc, not std.output3.inc

You do not have to write any code to call the ->_cm_post_fetchRow() method as that is automatically called in the ->fetchRow() method. It is one of those "hook" methods which is defined in the abstract class but which is empty. All you need to do is copy it into your table class and add some code.


Re: Output 5 (Label view) [message #7584 is a reply to message #7583] Sat, 27 February 2021 04:54 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 434
Registered: May 2014
Senior Member
Do you have an explanation why the logo-image will not be shown in the report when calling the std.output5.inc?
Re: Output 5 (Label view) [message #7585 is a reply to message #7584] Sun, 28 February 2021 05:02 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2368
Registered: April 2006
Location: Surrey, UK
Senior Member
That is the because the current implementation, as described in PDF Label View, only allows for each label to be defined as a single block of text. I will have to amend it to allow images to be inserted, but I cannot give a timeframe for this work as I am very busy on some highly important projects at the moment.

Re: Output 5 (Label view) [message #7586 is a reply to message #7585] Sun, 28 February 2021 06:01 Go to previous message
htManager is currently offline  htManager
Messages: 434
Registered: May 2014
Senior Member
Thank you for the response. I will prepare it, so I can use it as soon as you had the time to amend it.
Previous Topic: Key value / special characters /add4
Next Topic: Location of new (Sub-) System
Goto Forum:
  


Current Time: Mon Nov 25 02:36:41 EST 2024

Total time taken to generate the page: 0.02370 seconds