Page 1 of 1

Print child records with parent

Posted: 2014-02-18 14:20
by benzoD
I'm using a parent-child relationship to create comments for a record (as I described here.).

One issue I've run into with this set up is printing. When printing the parent, the children are not printed. What I'm going to do is create a new print template for parenttable_templateDVP.html that lays the child records out below the parent (including photos, which is a field in my comments), but I'm at a loss as to how to reliably call the children records for a particular parent. I know it's a MySQL query but after looking through the code generated by AppGini I'm not sure what I should use, as the queries are rather convoluted to my eyes.

Can anyone help me with this? What I'd like is a detail view of the parent and table view of the children below it if possible.

Re: Print child records with parent

Posted: 2014-03-01 08:51
by a.gneady
I'm planning to add this as an option in future releases .. But didn't work on the code yet unfortunately.

Re: Print child records with parent

Posted: 2014-03-07 19:06
by benzoD
That would be great. Can you give me some info on how the child is associated with the parent? Perhaps I could work it out if I knew a little more how it worked. Thanks for your help, Ahmad!

Re: Print child records with parent

Posted: 2014-03-09 12:03
by a.gneady
The lookup field in the child table stores the primary key value of the parent record. For example, if you have an "orders" table and a child "order_items" table that stores the items of each order, the order_items table would have a lookup field storing the order ID value to link items to a specific order.

Re: Print child records with parent

Posted: 2014-05-01 14:48
by TheCodeRed
Yes, this would be an extremely useful function for reporting. I have many customers that ask for similar type of reports. If there are active records under a parent table/record - to have the children records printed directed below it. Almost like a Crystal Reports layout.

Re: Print child records with parent

Posted: 2014-08-04 11:55
by magicalmutation
has anyone managed a quick fix yet to this?

Re: Print child records with parent

Posted: 2014-08-12 15:54
by TheCodeRed
Ultimately, the process for this is not that difficult. It is just a matter of preference and display.
Method 1:
Use SelectedID to run a while loop for records in another table based on SelectedID. Echo the results in table form and siplay the data from the fields you are looking for.

Method 2:
Use the Iframe (Secondary Table View method) to display the child tables records post filter using the Parent tables SelectedID.

Either method should work, but depending on how good with running queries or using the filtered results one method may be easier than the other for you.

It would be nice however if there was a GUI option for this. In AppGiini while building the application. There should be a second option next to the Linked Child tables box that asks if you want the child records to be displayed in a secondary table below the parent tables selected record.

Re: Print child records with parent

Posted: 2014-10-09 03:49
by tuxor
Do you have an example? I would like to print child records with parent.

Thank you