This topic is locked
[SOLVED]

 Conditional Child Tables

4/29/2016 10:46:44 AM
PHPRunner General questions
K
klyle author

I have a three level data relationship where the third level table depends on a value in a field of the second level. You could call the tables Application, Thing_Type, and Thing_Details. Different Thing_Types can have very different Thing_Details.
I created a switch statement for the Add page on Thing_Type so that it creates the correct Thing_Details record with all the FKs in place.
I need to find the code that generates the little "spider/org chart" icon for drilldown to related records, I think.
Or I need to define a relationship between Thing_Type and all 10 or so Thing_Details tables in my model, and hide all but the one that applies to each Thing_Type record.
Thanks for reading, and any ideas.

admin 4/29/2016

PHPRunner doesn't have such functionality built-in. There are a couple of ideas that may work for you.

  1. Create all potential master-details relationship and use 'Hide child table links if no child records exist' option.
  2. Or, if all details tables have the same database structure you can create a custom view for the child table display purposes and substitute child table SQL Query on the fly pulling data from relevant table.

K
klyle author 4/29/2016

Thanks, Sergey.
Your Option 1 works.
My issue was that I had set a couple of the relationships to use a single link, so PHPR was giving me 14 tabs for the third level in the relationship, and I had to click through all the tabs to find the one that contains the child record.
When I switch all the relationships to single links, I get a link which opens the correct tab automatically, which is good.
How can I hide the tabs for the 13 child tables which don't apply?
Update: One key is that the tab with data will be CSS classed as active and the others default.
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited {

display: none;

}
Will do it.

admin 4/29/2016

Unfortunately we do not have an option of of hiding child tabs programmatically.

K
klyle author 4/29/2016



Unfortunately we do not have an option of of hiding child tabs programmatically.


Thanks again, Sergey.
What I am seeing in my application is that I have "Proceed to Blah Add Button-Edit Button-Delete Button" in the third level detail area of the grid, after turning off the inactive tabs with CSS - I think because all the code is being run, and all those tabs are being generated before they are hidden by CSS.
I find that showing the third level details as a popup doesn't have this issue, but clicking on the second level details link automatically navs me to the third level list page, and I have to use the browser back button to get back to the top level list.
I really like the inline display, and would like to be able to programmatically suppress the unused tabs, but popup does let me avoid that issue.