It is currently Wed May 24, 2017 10:35 pm




Post new topic Reply to topic  [ 6 posts ] 
Creating a drill down, one parent showing only its children 
Author Message

Joined: Thu Aug 07, 2008 6:16 am
Posts: 8
Post Creating a drill down, one parent showing only its children
From a Data display showing rows in a parent table, click on one parent key and see another Data display over a child table showing only the children for that one parent row.

I have created a dynamic hyperlink from a column in the parent table (which, incidentally, could be an added column with only an icon in it, right?). From that parent Data display, with the hyperlink, I go to the child Data display. I included a parameter v_parent_id, defined in the hyperlink definition to carry the parent key. Below, that parent key is GClas_id.

The custom code might look like:

SQL = SQL & " Select" & vbCrLf
SQL = SQL & " geocategory.`GCat_id`," & vbCrLf
SQL = SQL & " geocategory.`GClas_id`," & vbCrLf
SQL = SQL & " geocategory.`GCat_name`," & vbCrLf
SQL = SQL & " geocategory.`GCat__id_code`," & vbCrLf
SQL = SQL & " geocategory.`GCat_description`," & vbCrLf
SQL = SQL & " geocategory.`GCat_effective`" & vbCrLf
SQL = SQL & " From" & vbCrLf
SQL = SQL & " geocategory geocategory" & vbCrLf

Custom Code for "after prepare query"

SQL = SQL & " WHERE geocategory.'GClas_id', = v_Clas_id " & vbCrLf

But, I need to be able to address the parameter v_Clas_id in the Child Data display form. Also, if no parm was passed to the page, can I include OR v_Clas_id IS NULL to show all child rows?

Al. al.rushing@hotmail.com


Fri Aug 22, 2008 6:22 am
Profile E-mail

Joined: Mon May 26, 2008 8:02 am
Posts: 65
Post Re: Creating a drill down, one parent showing only its children
Hi Al,

I don't think you need to do anything that complicated, if I understand your objective.

Basically you have a DATA page showing say 10 records. For a given record, you want to have a hyperlink (image or text does not matter) that will fly to another page to show some more information related to that parent record.

If your parent record carries multiple children records in the child table, then you need to use a 'Details' page. If your parent record always carry just 1 child record (or a query joining multiple tables but returning a single row of detailed data) then you need to use a MORE page.

Both Details and More pages can be within the same group as your DATA page or to another group. But it is easier within the same group because the Hyperlink and Parameters passed along will be automatically set for you by dbQwikSite.

If your DATA page (showing parent records) has the ID to the details page in column 'ParentID' and your details record column called 'GClas_id' used as a filtering column, then you would just need to do this type of mapping:

1. On the DETAILS or MORE page showing the child(ren) record(s), open the page settings dialog for it, you can define parameters like this (make sure the column names are the right ones):

Attachment:
HyperlinkTargetPage.gif


2. On the Data Page Item set as a Hyperlink, properties dialog, you would define the parameters like this:

Attachment:
HyperlinkSourceParams.gif


If you use a Details or More page within the same group as your Data page, the Hyperlink page item will be added automatically for you in the data page. If you define the Hyperlink item yourself because the Details or More page is inside another group, just set the parameters on both ends as shown in the above example. That should work.

No need for custom code.

However you do mention a special requirement in that if no parameter is provided you want to show only child records that have NULL values. This indeed may require custom code.

If you go the 'custom code way', then you can receive the parameter you have defined via the REQUEST object in ASP or $_GET in PHP.

In your case the custom code could look like this (ASP style):

Code:
If Request("v_Clas_id") > "" then
   SQL = SQL & " WHERE geocategory.GClas_id = '" & Request("v_Clas_id") & "' & vbCrLf
Else
   SQL = SQL & " WHERE geocategory.GClas_id IS NULL " & vbCrLf
End If



If this is not answering your question, please give us more details and we'll see what can be done.


You do not have the required permissions to view the files attached to this post.


Fri Aug 22, 2008 2:21 pm
Profile E-mail

Joined: Thu Aug 07, 2008 6:16 am
Posts: 8
Post Re: Creating a drill down, one parent showing only its children
This works great and really should be in the manual somewhere as drilldown is an important concept in business application programming (usually in intranet systems).

Many thanks for a complete explanation.

One note, going from a list of parent rows to another window of child rows works exactly as expected. The child rows will have a link back to the parent rows in yet a third window. This will select one single parent row in that window and doing so will supercede the list of parent rows in the first window leading to a display of only the single parent row in the first and third windows and losing the list of parent rows completely.


Thu Aug 28, 2008 1:42 am
Profile E-mail

Joined: Mon May 26, 2008 8:02 am
Posts: 65
Post Re: Creating a drill down, one parent showing only its children
You're welcome.

In your last paragraph you seem to point at a miss-behavior. I am trying to understand it.

Is it by design that you have asked for a new window to be opened on the 'way back' of the details (children) page? Or do you have your own hyperlink somewhere to do it?

The standard behavior is:

- I'm on the Data page, I click on 'Details' button/link for a given record
- I then get my Details page showing (replacing my data page, not in a new window)
- I click 'Back', the contents of my window goes back to the data page showing all records as on step 1

I have never seen dbQwikSite open a new window when you click 'back' of the navigation bar. However you can ask for a new window on the way TO the details page (a property of the Page Item on your Data page). If you chose to open the details page in a second window, clicking on 'back' will display the DATA page in that second window. It will not close the details window and go back to the initial data page. You end up with 2 windows both showing the data page.

This is how the settings would be if you chose to open in a new window:

Attachment:
Open Details Page in New Window.gif

Have you set your 'Details' link on the Data page to open the details page as a separate window?
Is there a URL you can post for us to see that behavior?


You do not have the required permissions to view the files attached to this post.


Thu Aug 28, 2008 9:42 am
Profile E-mail

Joined: Thu Aug 07, 2008 6:16 am
Posts: 8
Post Re: Creating a drill down, one parent showing only its children
I did not use Details because that limits drill down to 1 level. I often have 5 to 8 levels of tables in some hierarchies. So I used the other method putting a hyperlink in both the parent and child key columns. This works and allows only the children for a selected parent to appear in the new window. But, it also allows the parent key (which is all the same value, of course), to be clicked on as a link. This will bring up the one parent row by itself, which is cute and marginally valuable. This third window, with the single parent row in it must be closed before any paging or other manipulation is done in the original set of parents on the first screen. If not, only that single parent will be visible from any subsequent screen on that first one and there is no way I found to get back to the original list of parent rows.


Fri Aug 29, 2008 12:24 am
Profile E-mail

Joined: Sun Jan 13, 2008 1:49 am
Posts: 146
Location: Texas, USA
Post Re: Creating a drill down, one parent showing only its children
Can you explain and give code?


Sat Sep 19, 2009 9:51 pm
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Copyright © 2004-2008 TheDevShop Ltd. All Rights Reserved