Autor Beitrag
MH1987
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 98



BeitragVerfasst: So 06.05.07 23:29 
hi,

ich würde gerne eine AnwesenheitsListe vernünftig speichern!

Es soll zu einem Datum für jedes Kind ein bestimmer Zustand gespeichert werden.
Ich habe bisher ein Array genommen, bin mir aber nicht so sicher ob das so wie ichs benutze sinnvoll ist:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
const MaxKinder = 40;

type
  TMonth = (Jan,Feb,Mar,Apr,Mai,Jun,Jul,Aug,Sep,Okt,Nov,Dez);
  TDay = 1..31;
  TKind = 1..MaxKinder;  // Kinder sind woanders mit adresse gespeichert und jedes hat eine nummer
  TZustand = (
    Anwesend,
    Abwesend,
    Entschuldigt,
    Beurlaubt);
  TFehlMatrix = array [TMonth,TDay,TKind] of TZustand;


Kann mir jemand dazu was sagen, vielleicht gibt es ja sinnvollere Ideen.

Gruß,

MH1987
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 06.05.07 23:34 
Moin!

user profile iconMH1987 hat folgendes geschrieben:
ich würde gerne eine AnwesenheitsListe vernünftig speichern!

Unter welchen Gesichtspunkten ist das denn zu sehen? :nixweiss: ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
MH1987 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 98



BeitragVerfasst: So 06.05.07 23:44 
So dass ich später alles in einem Stringgrid schön ausgeben kann.
Also eine Übersicht auf der steht welches Kind wann nicht da war.

Gruß,
MH1987
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 06.05.07 23:46 
Moin!

user profile iconMH1987 hat folgendes geschrieben:
So dass ich später alles in einem Stringgrid schön ausgeben kann.

Was hat das mit dem Speichern zu tun? :gruebel: IMHO nix, und deshalb ist dieses "Speicher-Format" so gut, wie jedes andere. :P

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
MH1987 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 98



BeitragVerfasst: So 06.05.07 23:50 
Hab ich vergessen:

Sollte natürlich auch in eine TextDatei abgelegt werden.

also so:

Laden aus der TextDatei in ein "Speicher-Format"
Und später dann auch aus dem "Speicher-Format" die Übersicht erstellen.

Gruß,
MH1987
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 06.05.07 23:53 
Moin!

user profile iconMH1987 hat folgendes geschrieben:
Sollte natürlich auch in eine TextDatei abgelegt werden.
also so:
Laden aus der TextDatei in ein "Speicher-Format"

Ah ;) jetzt wird´s schon spannender: es geht also darum, das Datei-Format zu deinem Speicher-Format zu definieren! :idea:

Dann mach doch mal einen Vorschlag, wie du das umsetzen wolltest. ;) Davon hast du bisher ja noch gar nicht gesprochen. :P

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
MH1987 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 98



BeitragVerfasst: So 06.05.07 23:58 
In der TextDatei sollte dann folgendes stehen:

Datum;Kind1:Zustand;Kind2:Zustand; usw

mein Problem zur Zeit ist auch, dass in dem array ja praktisch alle Tage des Jahres enthalten sind, ich brauch aber ja nur jeweils einen Tag einer Woche.
Hatte erst überlegt in alle andre Tage als Zustand ne "0" oder sowas zu setzen, aber das is ja unnötiger speicher.

Gruß,
MH1987
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 07.05.07 00:08 
Moin!

Was hältst du denn von der Idee, eine TObjectList zu nehmen und in dieser Tag-Objekte aufzunehmen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
TDay = class(TObject)
private
  FDay: TDate;
  FChildStates: array[1..MaxChild] of TChildState
public
  constructor Create(const ADay: TDate);
  property Day: TDate read FDate;
  property ChildStates[Index: Integer]: TChildState read GetChildState;
end;

TObjectList stammt von TList ab, und da gibt es auch eine Methode .Sort, mit der kannst du die Liste dann nach Datum sortieren.

Zum Speichern: Je Tag eine Zeile, CommaText-Format zum Zerlegen via StringList, Aufbau:
Tag,x1,x2,x3,...,xn (xa: Zustand für Kind a an diesem Tag)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
MH1987 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 98



BeitragVerfasst: Mo 07.05.07 00:10 
genau sowas suchte ich!!

Vielen Dank :-)

Gruß,
MH1987