Autor Beitrag
rolandt4088
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

WINDOWS XP
Delphi 7, CodeGear RAD Studio
BeitragVerfasst: So 24.06.07 20:41 
Hallo,

derzeit habe ich drei Tabellen.

1. Hauptkategorie
2. u. 3. Unterkategorien (wobei 3 die u-kategorie von 2 ist)

Diese Form begrenzt mich aber in der Erstellung weitere U-Kategorien von 3.

Ist es nun besser alle Kategorien in einer Tabelle zu speichern oder noch weitere Tabellen hinzufügen?

Gruß
Roland
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: So 24.06.07 21:28 
user profile iconrolandt4088 hat folgendes geschrieben:
derzeit habe ich drei Tabellen.

1. Hauptkategorie
2. u. 3. Unterkategorien (wobei 3 die u-kategorie von 2 ist)

Diese Form begrenzt mich aber in der Erstellung weitere U-Kategorien von 3.

Ist es nun besser alle Kategorien in einer Tabelle zu speichern oder noch weitere Tabellen hinzufügen?
Wieso nimmtst Du nicht nur EINE Tabelle?

Wenn Du z.B. eine jvTreeview nimmst, kannst Du theoretisch unendlich viele Untergruppen in nur einer Tabelle ablegen.

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)
rolandt4088 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

WINDOWS XP
Delphi 7, CodeGear RAD Studio
BeitragVerfasst: So 24.06.07 21:32 
Hallo,

ich arbeite bereits mit einer Treeview.

Die Frage die sichmir stellt ist:

Wie bekommen die Kategorien die eindeutige Zuordnung:

Beispiel:
Bücher -> Belletristik -> Krimis & Thriller -> Wallace
-> Christie
-> Weltliteratur -> usw.

Da sind doch jedemenge Abhängigkeiten. Wie bekomme ich diese in eine Tabelle unter?

Gruß
Roland
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 24.06.07 21:35 
In dem du die Tabelle um ein Feld erweiterst, in das du den Vorgänger schreibst

_________________
Markus Kinzler.
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: So 24.06.07 21:38 
Aufbau der DB:
ausblenden Quelltext
1:
2:
3:
WG_ID            (AutoInc-Feld)
WG_Name          (Wie heisst der "Eintrag")
WG_Parent        (An welchem Ast hängt der Eintrag?)


Bsp.-Eintrag in der DB:
ausblenden Quelltext
1:
2:
3:
1  Warengruppe   0
2  Untergruppe1  1
3  Untergruppe2  2

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)


Zuletzt bearbeitet von Blawen am So 24.06.07 22:23, insgesamt 3-mal bearbeitet
rolandt4088 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

WINDOWS XP
Delphi 7, CodeGear RAD Studio
BeitragVerfasst: So 24.06.07 21:45 
Feld 1 Feld 2 Feld 3 Feld 4 Feld 5

Bücher
Bücher -> Belletristik
Bücher -> Belletristik -> Krimis & Thriller
Bücher -> Belletristik -> Krimis & Thriller -> Wallace

Ist so der Aufbau zu verstehen?
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 24.06.07 21:48 
Nein

1 Bücher 0
2 Belletristik 1
3 Liebesromane 1
4 Krimis & Thriller 2

_________________
Markus Kinzler.
arj
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 378

Win XP/Vista, Debian, (K)Ubuntu
Delphi 5 Prof, Delphi 7 Prof, C# (#Develop, VS 2005), Java (Eclipse), C++, QT, PHP, Python
BeitragVerfasst: So 24.06.07 21:51 
Einen Baum legt man im Allgemeinen in einer Tabelle ab:

Felder:
  • Index
  • Parent
  • Name


Dann kannst du das ganze in eine Tabelle packen, genauso wie du es eigentlich schon geschrieben hast.
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: So 24.06.07 21:51 
user profile iconmkinzler hat folgendes geschrieben:
Nein

1 Bücher 0
2 Belletristik 1
3 Liebesromane 1
4 Krimis & Thriller 2



Müsste es nicht so sein:
1 Bücher 0
2 Belletristik 1
3 Liebesromane 2
4 Krimis & Thriller 3

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)


Zuletzt bearbeitet von Blawen am So 24.06.07 21:56, insgesamt 1-mal bearbeitet
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: So 24.06.07 21:52 
Im Baum würde es so aussehen:

ausblenden Quelltext
1:
2:
3:
4:
Bücher 
  --> Belletristik 
      --> Krimis & Thriller 
            --> Wallace

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)


Zuletzt bearbeitet von Blawen am So 24.06.07 21:56, insgesamt 1-mal bearbeitet
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 24.06.07 21:55 
Nein, ich habe Liebesromane eingefügt um zu zeigen wie man parallele Eintrage erzeugen kann. Liebesromane ist auf der selben Ebene wie Krimis & Thriller und hat dehalb den selben Vorgänger (Parent)

_________________
Markus Kinzler.
rolandt4088 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

WINDOWS XP
Delphi 7, CodeGear RAD Studio
BeitragVerfasst: So 24.06.07 21:56 
Ich werde mal den Stahlknecht studieren. Vielleicht gibt es da ja eine bildliche Darstellung. Im Momment kann ich mir es nicht vorstellen wie das funktionieren kann.
Vielen Dank für Deine Bereitschaft zur Hilfe.

Gruß
Rolan
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: So 24.06.07 22:04 
user profile iconmkinzler hat folgendes geschrieben:
Nein, ich habe Liebesromane eingefügt um zu zeigen wie man parallele Eintrage erzeugen kann. Liebesromane ist auf der selben Ebene wie Krimis & Thriller und hat dehalb den selben Vorgänger (Parent)

Ok, so kann man es natürlich auch sehen, aber eine "Vorwarnung" wäre nicht zu verachten gewesen ;-)


@Roland: Das "bildliche" Ergebnis von mkinzler sieht so aus:
ausblenden Quelltext
1:
2:
3:
4:
Bücher 
  --> Belletristik 
      --> Krimis & Thriller 
  --> Liebesromane

Um die Reihenfolge der Einträge musst Du Dir übrigens keine Sorge machen, die Komponente setzt das Ganze von alleine zusammen.

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)
rolandt4088 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

WINDOWS XP
Delphi 7, CodeGear RAD Studio
BeitragVerfasst: So 24.06.07 22:08 
1 Bücher 0
2 Belletristik 1
3 Liebesromane 1
4 Krimis & Thriller 2

1,2,3,4 sind der Index vom Treeview?

0, 1, 1, 2 ?
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 24.06.07 22:09 
Nein, die IDs in der DB-Tabelle

_________________
Markus Kinzler.
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: So 24.06.07 22:12 
user profile iconmkinzler hat folgendes geschrieben:
Nein, die IDs in der DB-Tabelle
Im 4. Antwortposting ist der Aufbau der Tabelle beschrieben.

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)
rolandt4088 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

WINDOWS XP
Delphi 7, CodeGear RAD Studio
BeitragVerfasst: So 24.06.07 22:15 
Ich werde es jetzt mal in Ruhe ausprobieren.

Wenn es nicht klappt melde ich mich wieder.

Vielen Dank für die Hilfen.

Gruß
Roland
rolandt4088 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

WINDOWS XP
Delphi 7, CodeGear RAD Studio
BeitragVerfasst: So 24.06.07 22:25 
Ich glaube jetzt hab ich's!

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
id bezeichnung parent
1  Bücher       Null
2  Belletristik  1
3  Krimis        2
4  Weltliteratur 2
5  Tonträger    Null
6  CD            5
7  LP            5
8  Singel        7


Verstehe ich das jetzt richtig?
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: Di 26.06.07 20:46 
user profile iconrolandt4088 hat folgendes geschrieben:
Ich glaube jetzt hab ich's!

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
id bezeichnung parent
1  Bücher       Null
2  Belletristik  1
3  Krimis        2
4  Weltliteratur 2
5  Tonträger    Null
6  CD            5
7  LP            5
8  Singel        7


Verstehe ich das jetzt richtig?

Sieht gut aus. Vermutlich musst Du statt "Null" eine echte "0" vergeben.

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)
rolandt4088 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 122

WINDOWS XP
Delphi 7, CodeGear RAD Studio
BeitragVerfasst: Di 26.06.07 23:08 
Hallo,
jetzt muß ich das nur noch mit Treeview und gleichzeitigem Speichern in die Tabelle realisieren.
Ich habe schon viel im Internet gesucht aber so richtig noch nichts gefunden was mir weiter helfen kann.
Es wird aber, das ist mir klar, ein recht komplexer Code.