[Zope] Newbie: dtml-tree
Ashley Lloyd
ashleylloyd@hotmail.com
Fri, 21 Feb 2003 10:52:52 +0000
I am hoping to use dtml-tree to display the results of SQL statements. I
have looked around, and there seems to be quite a bit of information on
dtml-tree, but much of it is out of date, and most only uses it to list
folder contents.
The data structure is as follows:
The root node would be a result of an SQL which can only yield one result -
say, warehouseNameSQL returns Warehouse name given the Warehouse ID.
Then, an SQL statement (say productsInWareSQL) returns all products in that
warehouse, sorted by category. The next level below root would be product
categories, the third product names/ids. So, if the category (say categoryB)
of product3 is the same as product2, then this is just listed as a sibling
of product2 (both children of categoryB). If product3 is in categoryC,
however, categoryC is listed as a sibling of categoryB, and product3 as the
first child.
I know I didn't explain that very well, so more graphically I want the tree
structure to look something like this:
Warehouse_Alpha
- CategoryA
Product1
Product2
- CategoryB
Product3
- CategoryC
Product4
Product5
Product6
Product7
Product8
Product9
- CategoryD
Product10
Can anyone tell me if this is possible with dtml-tree, and if so give me
some ideas as to how.
I've tried implementing it, and I can get a list of the Categories, but
instead of listing each category once, it lists each category once for every
product in that category. I also can't expand the tree at all, as when it
attempts to expand it seems to lose the initial Warehouse ID, and gives a
NameError (global name 'warehouseID' is not defined).
(I've tried setting urlparam to be "'warehouseID='+warehouseID", but it
seems to want only a static string, not one that is made up depending on the
value passed to the document.)
There is no problem with the sql, as I have implemented it without using
dtml-tree, just indenting levels further using columns. We would, however,
much prefer to use a proper tree structure.
TIA
Kind regards
Ashley
_________________________________________________________________
Chat online in real time with MSN Messenger http://messenger.msn.co.uk