Print child records with parent

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
benzoD
Veteran Member
Posts: 69
Joined: 2013-01-31 21:16

Print child records with parent

Post by benzoD » 2014-02-18 14:20

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.

User avatar
a.gneady
Site Admin
Posts: 1354
Joined: 2012-09-27 14:46
Contact:

Re: Print child records with parent

Post by a.gneady » 2014-03-01 08:51

I'm planning to add this as an option in future releases .. But didn't work on the code yet unfortunately.
:idea: AppGini plugins to add more power to your apps:

benzoD
Veteran Member
Posts: 69
Joined: 2013-01-31 21:16

Re: Print child records with parent

Post by benzoD » 2014-03-07 19:06

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!

User avatar
a.gneady
Site Admin
Posts: 1354
Joined: 2012-09-27 14:46
Contact:

Re: Print child records with parent

Post by a.gneady » 2014-03-09 12:03

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.
:idea: AppGini plugins to add more power to your apps:

TheCodeRed
Posts: 26
Joined: 2014-05-01 12:57

Re: Print child records with parent

Post by TheCodeRed » 2014-05-01 14:48

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.

magicalmutation
Posts: 11
Joined: 2013-08-07 17:15

Re: Print child records with parent

Post by magicalmutation » 2014-08-04 11:55

has anyone managed a quick fix yet to this?

TheCodeRed
Posts: 26
Joined: 2014-05-01 12:57

Re: Print child records with parent

Post by TheCodeRed » 2014-08-12 15:54

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.

tuxor
Veteran Member
Posts: 48
Joined: 2014-06-15 00:09

Re: Print child records with parent

Post by tuxor » 2014-10-09 03:49

Do you have an example? I would like to print child records with parent.

Thank you

Post Reply