Steve Conklin (Developer@UltraDNT)
Developer at UltraDNT.com
Wed Jul 21 21:28:00 CDT 2004
Well, I had 6 beers (and counting) ... But ... Shouldn't this already exist? > table (OrderDetailTypes) with one of each OrderDetailType... > so that there's a combo when choosing the detail type upon entry? If its not in a table, isn't it then a DISTINCT query, not a union, to get a single list of all existing types? And, further, wouldn't your key be: type & customer, (I don't like multi-column pk either, but I see no other choice) so if Select * where customer =1 and type = 4 returns no records, there are no child rows to add. I haven't seen your cool code for treeviews, but you may be up against a situation where you have to customize something non-re-usable ... Going now for # 7 Steve -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of MarkH Sent: Wednesday, July 21, 2004 8:49 PM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Treeview Problems Taking into account I'm on my third glass of wine and its real late... Not sure if I took it all in but I have a similar situation where for each node at a given level I want to create child nodes for all possible parameters etc. I make the index (key of the node) unique by combining the parameters (child) primary key with the parent nodes key. If I need to create relationships where none exist (i.e. to get all records etc.) I just create a dummy column in each query with the same value, e.g. "'asd' AS theKey" and join on that... Hth... Mark -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: 22 July 2004 00:48 To: AccessD Subject: [AccessD] Treeview Problems Some of you may have read my stuff about data-driven treeviews. Lately I have run into a problem using my own code, and am looking for a graceful way out. If you've read or at least run the code, then you know that it reduces the population of any given level to a simple select statement, using a query, a table, a view or a UDF. However, my current problem is this: Let's suppose that you have parent table P and child table C, which references an FK F (i.e. OrderDetailType.... Assuming that there can be several types of OrderDetail, say CarRental, CampGroundSite, CanoeRental, etc. ((hey, it's summer and I need to revisit Killarney Park, one of the most beautiful places in the world, so forgive my examples)). Assume that Treeview level 1 is Customer. TV level 2 is Orders. Treeview Level 3 is all the possible order detail types. TV 4 is the detail types arranged under TV3. I.e. 1: ABC Company DEF Company 2: Order 123 from ABC Order 125 from ABC Order 126 from DEF Order 139 from DEF 3: CarRental CampGroundSite CanoeRental Etc. 4: Specific instances of CarRental, CampGroundSite, CanoeRental, etc. My code so far can handle levels 1 and 2 easily, one statement per level. The problem is at level 3. I want to populate the treeview at level 3 with all the order detail types (CarRental, CampGroundSite, CanoeRental, etc.) for each Order. It's a simple UNION query to do this, but where do I get the unique key? Generalizing my problem, I have a simple (and dare I say it pretty cool) way of populating the data-driven levels of a treeview. But that's insufficient for my current problem. I need to populate the OrderDetailTypes level with all possible order detail types and then sub-populate level 4 with the corresponding children. I'm at a loss how to achieve this. One way to do it, which would fall conveniently into my current scheme, is to populate a bridge table (OrderDetailTypes) with one of each OrderDetailType... But that sucks, IMO. It stores a bunch of data that is most of the time unnecessary. I HATE unnecessary detail! I'll go there if I have to, but it makes me gag. Generalizing the problem.... Given: code that can populate any tree-level with a simple select How to insert a level that is not data-driven or alternatively is data-driven but not with related FKs Treeview nodes insist upon unique keys (understandably so). But how should I manufacture said unique keys given that no physical rows correspond to them. Maybe the generalization is: how to relate a grandchild to a parent in the absence of parental data? That might be an incorrect phrasing, but that's what I mean. I hope that I have stated the problem clearly enough for you to follow the logic. If not, please reply for further clarification. Any suggestions much appreciated. TIA, Arthur -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com