Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creat Hierarchy
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00033688
Message ID:
00033741
Vues:
49
> > I wonder if someone can tell me a way of building a hierarchy in a > database. Like when I build levels in a wordprocessor like 1.1, 1.2, 1.2.1 > etc. The purpose should be to put articles in a table and keep track of > article groups. The problem is (as I can see) the levels are not fix, eg > one article can be on level two, say 1.1.1 and another one can be on level > three say article 1.2.3.1, that is the first article of level 1.2.3. I would create a table structure similar to: LEVEL1 Numeric 3 LEVEL2 Numeric 3 LEVEL3 Numeric 3 LEVEL4 Numeric 3 LEVEL5 Numeric 3 TITLE Character 60 etc. and then index on: STR(LEVEL1)+STR(LEVEL2)+STR(LEVEL3)+STR(LEVEL4)+STR(LEVEL5) Do Not include the length of the field in the STR() statements, so that you can change the length later without having to change your code. If you open the index DESCENDING, and then seek STR(1)+STR(2)+STR(3) before you add the second article above, then you won't find any records. You'll then know that the first one to create is 1.2.3.1. If you attempt the search a second time, you'll come across that record and know that the next article is 1.2.3.2. -- Paul Russell Software Kinetics Ltd. | Phone: (902) 481-4582 Fax: (902) 468-3679 201 Brownlow Avenue | Office: Paul.Russell@SofKin.ca Dartmouth | "The best evidence that time travel will never be Nova Scotia, Canada | possible is that we have not been invaded by B3B 1W2 | hordes of tourists from the future." - S. Hawking "Use technology because it's appropriate -- except in the case of 'Java' then just use it 'cause it's cool!" - Paul Russell
Paul Russell
EMail: prussell@fox.nstn.ca
Phone: (902) 499-5043
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform