Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hierarchy table structure
Message
De
03/01/2002 17:56:53
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
03/01/2002 17:37:51
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00600157
Message ID:
00600546
Vues:
19
>>Basically I agree with both you and Peter: two tables - items and composition, where composition has two foreign keys: one to parent record in items (to "the item whose recipy this is") and the other to the item table as a lookup (this ingredient is this item). Any ingredient in itself could be a simple item or another composite - but in any case I had there were never more than 3-4 levels. I've heard that even the big ocean ships don't have more than 6-7 levels in their assembly list.
>
>Yes; the two-table structure (articles, composition) allows virtually any number of levels, but for practical purposes, for the end-user, the number of levels should be limited.

I put a limit after testing - I once manually created an endlessly repeating composition, and tried to display it. On my machine (which had only 4 megs at the time) it broke when attempting to display the 6th level; on better machines it would go as far as 8 to 10. So I put a limit at 5.

>>Now the weirdest thing of all: I once spoke with a guy who had a theory that the accounting can be done this way... we were not completely sober, but he was making a lot of sense.
>
>I tried something in this sense, a while ago. Actually, it was a single table, because each account only has a single "parent" (the second table is required to resolve the many-to-many relationships: article "parent" can contain many "childs", and article "child" can be contained in many "parents").
>
>I also showed the accounts in a treeview. However, the whole project was eventually aborted, and I couldn't test it in practice. I'm no accounting expert, so I'm not very sure about the merits or not of this approach.

Depending on the accounting system, this can work or not. In Yugoslavia there's a double-balance system with a tree-like "account frame" (as they call it now, previously it was "account plan"), where any item would be credited or debited to one account, and a counteritem to another account on the opposite side, so the whole set of items would always have to be in perfect balance. The account plan was divided into ten classes (as per first digit of each account, or let's call that single-digit accounts), then each was split into 3-digit accounts, and the structure so far was prescribed by the law. Beyond that, any chief accountant could invent sub-accounts with up to 8 digits. So, basically, this already had a tree structure and could be used as such, and could even be done recursively.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform