Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to resolve structured data ??
Message
From
26/10/2005 16:01:24
Al Doman (Online)
M3 Enterprises Inc.
North Vancouver, British Columbia, Canada
 
 
To
26/10/2005 08:15:21
Albert Beermann
Piepenbrock Service Gmbh & Cokg
Osnabrück, Germany
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
Database:
MySQL
Miscellaneous
Thread ID:
01062177
Message ID:
01062388
Views:
11
>Hello Everbody
>
>We have a table rbobjekte with structured data (like bill of material)
>rbobjekteid ,rboberobjektid (the objectid of the object above), .....
>
>The startpoint of a structure has objectid = rboberobjektid
>
>Example:
>start = aera x (rbobjekteid=111,rboberobjektid=111)
>building a in aera x (rbobjekteid=4711,rboberobjektid = 111)
>building b in aera x (rbobjekteid=4813,rboberobjektid = 111)
>building c in aera x (rbobjekteid=4333,rboberobjektid = 111)
>
>floor 1 in building a (rbobjekteid=5711,rboberobjektid = 4711)
>floor 2 in building a (rbobjekteid=6711,rboberobjektid = 4711)
>floor 3 in building a (rbobjekteid=5731,rboberobjektid = 4711)
>
>floor 1 in building b (rbobjekteid=35711,rboberobjektid = 4813)
>floor 2 in building a (rbobjekteid=6711,rboberobjektid = 4813)
>
>room a in floor 1 of building a (rbobjekteid=46711,rboberobjektid = 5711)
>
>....
>
>I have an application that shows strucured customer data in a treeview All objects are treeview nodes that you can expand or shrink
>
>Table objects holds 1500000 records
>Table services holds 80000000 records
>and both are still growing
>
>To resolve a customer aera(l_startobjekt) we use the following comand via odbs against a maxdb database
>
>l_cmd = "DECLARE RNAME CURSOR FOR WITH RECURSIVE TMPOBJ " +;
>"(LEVEL, rbobjekteid, oberobjektid) " +;
>" AS (SELECT 1, ro.rbobjekteid, ro.oberobjektid " +;
>" FROM rbobjekte ro " +;
>" WHERE oberobjektid = ?l_startobjekt "+;
>" UNION ALL SELECT TMPOBJ.LEVEL + 1, ro.rbobjekteid, ro.oberobjektid
>" FROM rbobjekte ro , tmpobj " +;
>" WHERE ro.oberobjektid = TMPOBJ.rbobjekteid)"+;
>" SELECT tmpobj.* FROM TMPOBJ order by tmpobj.level,tmpobj.rbobjekteid"
>
>DO p_sqlcmd IN p_funktionen WITH p_verbindungsnr,l_cmd,(thisform.l_cursor)
>
>(8000 objects in 1 second !!!)
>
>We have a similar table in foxpro (9.0) and i don't know, how to do the resolving in foxpro (same performance ??)
>
>Any help or ideas welcomed

Without looking into it too deeply, it looks like MaxDB supports queries with a RECURSIVE keyword which automatically drills down through layers/nodes. VFP does not support this.

Speaking very generally, if your data structure has a fixed number of levels, you might be able to run a query with nested subqueries (which are newly supported in VFP9). If that won't work you might have to write a recursive function.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform