xBrowse Table records with a subtree

xBrowse Table records with a subtree

Postby reinaldocrespo » Thu Dec 13, 2012 6:46 pm

Hi everyone;

I'm interested on xbrowsing a table and then possibly show a subtree under each record. I should avoid reading the whole table into tree branches as the table may contain hundreds of thousands (if not millions) of records. The idea is to respond to a double click on a record by opening a subtree under it.

This would be perfect to show records from a master table with childs from a different table as a subtree of each master record.

Is this even possible?

Thank you,



Reinaldo.
User avatar
reinaldocrespo
 
Posts: 972
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: xBrowse Table records with a subtree

Postby reinaldocrespo » Sat Dec 15, 2012 2:11 am

No ideas or is it a bad question?

Reinaldo.
User avatar
reinaldocrespo
 
Posts: 972
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: xBrowse Table records with a subtree

Postby Euclides » Sat Dec 15, 2012 4:10 pm

Reinaldo,
See if \FWH\SAMPLES\XBRWDISK.PRG can help.
Regards, Euclides
User avatar
Euclides
 
Posts: 154
Joined: Wed Mar 28, 2007 1:19 pm

Re: xBrowse Table records with a subtree

Postby reinaldocrespo » Sat Dec 15, 2012 5:06 pm

Euclides /All;

Thank you for participating on this thread.

The sample you make reference to, as well as any other I've seen so far, pre-builds the tree and subtree in memory. That, surely, will not work when you need to xbrowse a table with millions of records.

Imagine, for example, that you have an xbrowse on the customers table with 1M records and that by Right-clicking on the customerID cell, you open a sub-tree with a list of detail transactions from a sales table. The sub-tree of transactions could be built in memory since it is unlikely that the number of transactions will overflow memory limits, but you CAN NOT load the 1M customers into a tree to be xbrowsed, as it would take for ever to load and no amount of memory would handle it.

I think xbrowse needs to be expanded to allow creation of a subtree on the fly on an existing aliased (table) xbrowse. I wish the argument will persuade Mr. Rao or whomever is in charge of xbrowse now days.


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 972
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: xBrowse Table records with a subtree

Postby Otto » Sat Dec 15, 2012 7:53 pm

Reinaldo,
is it something like this you want:
I use here 2 xBrowse.
Best regards,
Otto

Image


Image


Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6047
Joined: Fri Oct 07, 2005 7:07 pm

Re: xBrowse Table records with a subtree

Postby reinaldocrespo » Sat Dec 15, 2012 8:14 pm

Otto;

Hi. Instead of having two xbrowses, like in your picture, imagine that the info on the 2nd xbrowse shows only if you right click on the parent xbrowse line, and that the detail info shows on indented rows right underneath the parent row on the same xbrowse. Just like a tree on a single xbrowse.

Speaking in "tree" terms, in your sample picture, the branches of the tree shows on the left while the leaves of the tree shows on the right. you move on the branches, and the leaves changes. That's nice. But is not like a tree on a single xbrowse. Imagine one single xbrowse with branches, at some keyboard or mouse action, the leaves shows underneath the branch. Elegant and beautiful.

Don't think that don't appreciate the current implementation of fw xbrowse control. We do have the ability to load a tree on an xbrowse that works well if you can load the whole parent (branches) table into the tree before xbrowsing. But that won't work for any production size table, such as any master table -say the customers table that might contain 1M records.

The control I'm describing here exists for other development languages. I was hoping I could get fwh developers interested un further enhancing xbrowse to do the same.

Thank you for posting,


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 972
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: xBrowse Table records with a subtree

Postby Otto » Sat Dec 15, 2012 9:20 pm

Reinaldo,
look at the right xBrowse in RAO notes.
Here I use
:bIndent := { ||20 + ( ::cAlias )->TREELEVEL * 20 } .
With this it is easy to reach what you want.
:bIndent block and original xBrowse is much more flexible .
Please post a screen to demonstrate what exactly you want.
Best regards,
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6047
Joined: Fri Oct 07, 2005 7:07 pm

Re: xBrowse Table records with a subtree

Postby reinaldocrespo » Sun Dec 16, 2012 12:00 am

Sure. Here is a screen shot.

Image

I thought it would be easier to see and appreciate; ---have a large master table on an xbrowse, at some keyboard or mouse action, let the detailed child transactions open-up and show just underneath the master record they belong to. It is possible the that contents of the cells on the detailed records will not exactly match those of the parent record but that's ok. The idea is to be able to show detailed transactions at-hoc on the same xbrowse. Keep in mind that detail transactions may come from a different table.

Currently you can do this with fwh by xbrowsing a tree. But you can't make a tree out of large table -such as any real world master table. After about 10k records, an in memory linklist stops being practical. Any real world master table will be 20 times that size.


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 972
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: xBrowse Table records with a subtree

Postby Otto » Sun Dec 16, 2012 9:20 am

Reinaldo,
Can’t you insert a field in your database “ShowonTree” .
When browsing you show only these fields with true.
Then on click you search for the releted products what you call in you post subtree open the database again and set “ShowonTree” to true.
The refresh() method of xBrowse does the rest.
With
:oDataFont := { || }
:aCols[ 1 ]:bIndent := { || }
you can make the treeview look.
You can make a relation between the two databases to show the “subtrees”.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6047
Joined: Fri Oct 07, 2005 7:07 pm

Re: xBrowse Table records with a subtree

Postby reinaldocrespo » Sun Dec 16, 2012 10:37 pm

Otto /Everyone;

hummm, I'm afraid I haven't done a good job at exposing how a tree on an xbrowse works. Surely no one on the forum is getting what I've been trying to explain. I will try to do better on a new thread.

Thank you very much


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 972
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 40 guests