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

Home » RADICORE development » Transaction Patterns » output2 with parent/child tables
output2 with parent/child tables [message #4587] Thu, 02 October 2014 06:11 Go to next message
htManager is currently offline  htManager
Messages: 415
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 #4588 is a reply to message #4587] Sun, 05 October 2014 05:13 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
If you want to emulate what I have done with my sample PDF invoice I suggest that you unzip my 'Example' subsystem and take a look at the code.

Re: output2 with parent/child tables [message #4590 is a reply to message #4588] Mon, 13 October 2014 11:37 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 415
Registered: May 2014
Senior Member
I did investigate the code of the invoice example and tried to create a similar report. But I failed. I think that it is better for me to use an output2 pattern.

In the $structure[title] section I can define different fields one after another in one line. Is it possible to show the fields 'floating'. I don't know how to express this correctly. What I mean is, that I have to define the width of each field. But if I have defined a width of 20 and I have only three characters there is much space between this and the next word.

The second question I have is the following: Can I group the list view by a column in the same manner as the list view with totals? For your understanding what I mean: I have a team with members. Each member is categorized by a certain position(as 'Star sign' in your example). I want to create a list where all members of a position are grouped under his/her position. I hope you can imagine what I want.
Re: output2 with parent/child tables [message #4591 is a reply to message #4590] Tue, 14 October 2014 06:00 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
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.


Re: output2 with parent/child tables [message #4592 is a reply to message #4591] Tue, 14 October 2014 08:55 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 415
Registered: May 2014
Senior Member
Thank you very much for the information. I will try what you proposed and I hope that I succeed.
Re: output2 with parent/child tables [message #4594 is a reply to message #4592] Tue, 14 October 2014 11:48 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 415
Registered: May 2014
Senior Member
Sorry, but I didn't succeed.

(1) I looked at your example in option_list(a).php and changed my $sql_select statement as discribed below:

$sql_select = 'CONCAT(vereine_kuerzel, \' \', mannschaften_id) AS mannschaft_name';

In the report I changed the entry in:

$structure['title'][] = array('text' => '%%mannschaft_name', 'width' => 15, 'align' => 'left', 'x' => 25, 'y' => 0);

But there is no output. What did I wrong?

(2) Can I get a field value of the parent table within the above sql_select statement? I want to show a logo image file in the child report title. But the file name is stored in the parent table. I think that this should work with outer/inner join in a way as you showed in option_list(a).php. Did you somewhere describe this problems in one of your documentation? Or can you tell me what SQL-expression I should looking for to get information how to handle it?

Once more, thanks for your patience!
Re: output2 with parent/child tables [message #4596 is a reply to message #4594] Tue, 14 October 2014 18:03 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
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.


Re: output2 with parent/child tables [message #4597 is a reply to message #4596] Wed, 15 October 2014 11:16 Go to previous message
htManager is currently offline  htManager
Messages: 415
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.
Previous Topic: Error running output2 pattern
Next Topic: Different Categories
Goto Forum:
  


Current Time: Thu Mar 28 16:43:21 EDT 2024

Total time taken to generate the page: 0.01279 seconds