Autor Beitrag
Stoffel1984
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 219

Win NT, Win 2000
D6 Prof
BeitragVerfasst: Mi 22.10.03 11:39 
Hallo,

momentan setze ich den Filter meiner Tabelle so:

ausblenden Delphi-Quelltext
1:
AdsTable1.Filter := 'Markiert = ' + QuotedStr('X');					


Wenn ich jetzt einen Filter bzw. ein weiteres Kriterium einfügen will, bekomme ich Probleme:

ausblenden Delphi-Quelltext
1:
AdsTable1.Filter := ('Markiert = ' + QuotedStr('X')) and ('Land =  + QuotedStr('D'));					


Ist dies die einzige Möglichkeit Filter zu adden? Dies ist sehr umständlich.
Weis jemand mehr?

Gruß, Stoffel
neojones
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1206
Erhaltene Danke: 1



BeitragVerfasst: Mi 22.10.03 12:32 
Wieso sollte das umständlich sein? Und was für Probleme gibts da?

Naja, die Alternative wäre richtiges SQL.

Viele Grüße,

Matthias

_________________
Ha! Es compiliert! Wir können ausliefern!
Stoffel1984 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 219

Win NT, Win 2000
D6 Prof
BeitragVerfasst: Mi 22.10.03 12:44 
Naja umständlich deshalb, weil mein Programm sehr dynamisch mit den Tabellen umgeht. Etwas in der Form Filter.Add() wäre schöner!

Richtiges SQL ist keine Alternative. Zumindest für mich nicht, da ichs nicht kann :wink:

Stoffel
neojones
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1206
Erhaltene Danke: 1



BeitragVerfasst: Mi 22.10.03 17:12 
Einige Table-Komponenten unterstützen Macros, allerdings kann ich damit nur bei den SciBit-Komponenten umgehen. Sorry. Evtl. weiß sonst jemand hier noch Rat?

Viele Grüße,

Matthias

_________________
Ha! Es compiliert! Wir können ausliefern!
hwb
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 91

Win98 SE, Win2000
D5 Prof
BeitragVerfasst: Do 23.10.03 06:55 
So gehts doch auch mit ADS.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TForm1.Button1Click(Sender: TObject);
begin
  ADSTable1.AdsSetFilter('Country = "US"');  // ersten Filter setzen
end;

procedure TForm1.Button2Click(Sender: TObject);
var Filter: string;
begin
  Filter := ADSTable1.AdsGetFilter;  // Filter auslesen
  Filter := Filter + 'AND State = "CA"';  // Filterstring ändern
  AdsTable1.AdsSetFilter(Filter);  // neuen Filter setzen
end;

getestet ADS 6.2 und D5

Gruß
Hans

Moderiert von user profile iconTino: Code-Tags hinzugefügt.
Stoffel1984 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 219

Win NT, Win 2000
D6 Prof
BeitragVerfasst: Do 23.10.03 08:32 
Hallo Hans,

schonmal danke für deine Antwort! Syntaktisch ist mir das jetzt klar. Wusste gar nicht das die AdsTables eigene Filter Proceduren haben.

Hab momentan nur ein Problem. Ich möchte nur Datensätze anzeigen in denen ein bestimmtes Feld leer ist. Momentan mache ich das so:

ausblenden Delphi-Quelltext
1:
AdsTable1.AdsSetFilter('"Datei gesendet am" = ""');					


Allerdings zeigt er mir dann gar keinen Datensatz an obwohl in der Tabelle solche Datensätze stehen. Liegt es vielleicht an dem Feldnamen der aus mehreren Wörtern besteht? Oder ist solch eine Abfrage einfach nicht möglich?

Danke schonmal,

Stoffel
neojones
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1206
Erhaltene Danke: 1



BeitragVerfasst: Do 23.10.03 09:40 
"Datei gesendet am" IS NULL

Sollte eigentlich gehen.

Viele Grüße,

Matthias

_________________
Ha! Es compiliert! Wir können ausliefern!
Stoffel1984 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 219

Win NT, Win 2000
D6 Prof
BeitragVerfasst: Do 23.10.03 10:51 
Danke neo allerdings macht er mir auch das nicht. Das ist doch SQL oder? Ich arbeite nicht mit SQL Queries. Wenn ich das so eingebe bekomme ich die Meldung, dass ein "unsupportet Operator" in der Filteranweisung vorkommt.

So langsam regt mich dieser Mist echt auf.... :x

Danke aber für den Tipp!

Stoffel
hwb
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 91

Win98 SE, Win2000
D5 Prof
BeitragVerfasst: Do 23.10.03 11:08 
DAS ist nicht SQL und funktioniert !

ADSTable1.AdsSetFilter('gesendet am = NULL');

such mal die Advantage Expression Engine:

Advantage ADT table types support true NULL values for all field types. If a true NULL value is supplied as part of the expression or as a parameter to an expression engine function listed below, the final result of the expression is NULL. The only exception is the EMPTY function that returns True if a NULL value is supplied as a parameter and returns False otherwise.

Auch wenn ich eigentlich kein englisch kann, aber das bichen bekomm ich doch zusammen.

Gruß Hans
Stoffel1984 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 219

Win NT, Win 2000
D6 Prof
BeitragVerfasst: Do 23.10.03 11:52 
Oh Mist! :autsch:

Ich hatte noch die doppelten Hochkommatas drin :wink:
Klar das er das so nicht konnte....
Hans, ich konnte nicht nachschauen, da ich die Advantage Hilfe nicht aufm Rechner hab. Sorry.

Aber nochmal ein dickes Dankeschön an euch 2 für eure Hilfe!


Stoffel