output2 with parent/child tables [message #4587] |
Thu, 02 October 2014 06:11 |
htManager
Messages: 439 Registered: May 2014
|
Senior Member |
|
|
Hi Tony,
I have a question concerning the pdf output2 pattern with parent-/child tables.
I want to show the child occurences of the parent record in the same way as you created the pdf invoice example. My child records would be the items in the invoice example. Is this allright?
I want to create a subclass of the parent class where I can get all the necessary data by the _cm_output_multi() function.
Is this the right way or is there a better one?
|
|
|
|
|
Re: output2 with parent/child tables [message #4591 is a reply to message #4590] |
Tue, 14 October 2014 06:00 |
AJM
Messages: 2371 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
(1) It is not possible to show the "floating" as you require. Each field has a defined width which cannot be adjusted to cover the data it contains. If each field contains a single word, and you want this string of fields/words to be shown with only one space between each word, then it cannot be done. What you must do is concatenate all those words into a single field,then display that single field.
(2) The output of data in any PDF report is mainly controlled by the SQL query which you use to extract data from the database. The PDF processing will simply take each record that is produced from that query and process it before moving on to the next record. Any sorting or grouping must therefore be done in the SQL query *BEFORE* you send that data to the PDF object.
The documentation at http://www.tonymarston.net/php-mysql/output-to-pdf.html clearly identifies the various options which are available, so if you want something which is not in this document then it's probably not available.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
|
Re: output2 with parent/child tables [message #4596 is a reply to message #4594] |
Tue, 14 October 2014 18:03 |
AJM
Messages: 2371 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
As an experiment I tried adjusting the contents of file xample\reports\en\x_person.list.report.inc and changed line 16 from
$structure['title'][] = array('text' => '- Contents of X_PERSON table -',
to
$structure['title'][] = array('text' => '%%last_name',
and it worked perfectly.
I suggest you step through with your debugger to see what is going wrong in your code.
When reading from a database table it is possible in the SQL query to JOIN to other tables to obtain other values, then that data can be handled in the code as if it came from the first table. All you have to do is construct a valid query.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
Re: output2 with parent/child tables [message #4597 is a reply to message #4596] |
Wed, 15 October 2014 11:16 |
htManager
Messages: 439 Registered: May 2014
|
Senior Member |
|
|
Concat: As you told, it works also perfectly with me. My fault was that I changed the wrong php file.
To construct a valid sql query is obviously too difficult for me. But I get the value by the _cm_getExtraData in the parent class and I store this value in the $_SESSION variable.
I am happy now - til the next problem rises up.
|
|
|