Autor Beitrag
Arne Danikowski
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 194



BeitragVerfasst: So 16.09.07 15:50 
Hallo,

ich versuche grade eine Tabelle zu Filtern. Dabei sollen zwei Filterbedinngungen erfüllt werden:
ausblenden Delphi-Quelltext
1:
table1.filter:= 'archiv <>' +QuotedStr('Ja') or 'papierk <>' +QuotedStr('Ja');					


funktioniert aber nicht.

Wo liegt mein Denkfehler?
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: So 16.09.07 16:16 
user profile iconArne Danikowski hat folgendes geschrieben:
funktioniert aber nicht.
Ein bisschen genauer wäre schon nicht schlecht.

Ich denke aber, dass es gut wäre, die Bedingungen korrekt mit Klammern zu versehen.
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: So 16.09.07 16:19 
Und ein paar mal Quotes sortieren dürfte auch nicht schaden, sieht man schon am Highlighter...

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
Arne Danikowski Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 194



BeitragVerfasst: So 16.09.07 19:19 
beim kompelieren kommt. Operation nicht anwendbar. Ich habe das ach mal in Klammern gesetzt.
ausblenden Delphi-Quelltext
1:
table1.filter:= ('archiv <>' +QuotedStr('Ja') or 'papierk <>' +QuotedStr('Ja'));					


gleiches Problem.
Hatte ich erwähnt, das ich Anfänger bin?
dummzeuch
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 593
Erhaltene Danke: 5


Delphi 5 ent, Delphi 6 bis Delphi XE8 pro
BeitragVerfasst: So 16.09.07 19:29 
user profile iconArne Danikowski hat folgendes geschrieben:
beim kompelieren kommt. Operation nicht anwendbar. Ich habe das ach mal in Klammern gesetzt.
ausblenden Delphi-Quelltext
1:
table1.filter:= ('archiv <>' +QuotedStr('Ja') or 'papierk <>' +QuotedStr('Ja'));					


gleiches Problem.
Hatte ich erwähnt, das ich Anfänger bin?


Noe, hattest Du nicht.

Table1.Filter ist eine String-Property, d.h. es muss heissen:

ausblenden Delphi-Quelltext
1:
table1.filter:= '(archiv <>' + QuotedStr('Ja') + ') or (papierk <>' + QuotedStr('Ja') + ')';					


twm
Arne Danikowski Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 194



BeitragVerfasst: So 16.09.07 20:51 
danke für die schnelle hilfe.

das ganze funktioniert soweit.

Wie aber muss das ganze aussehen, wenn ich den Filter nur auf "oder" haben möchte?

also entweder wenn archive den Wert 'Ja' enthält ODER Papierk den Wert 'ja'?

So wie es oben ist also.

ausblenden Delphi-Quelltext
1:
table1.filter:= '(archiv <>' + QuotedStr('Ja') + ') or (papierk <>' + QuotedStr('Ja') + ')';					


werden die Datensätze nur herausgefiltert wenn archiv UND Papierk den Wert 'Ja' enthalten

mfg
Arne Danikowski Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 194



BeitragVerfasst: Mi 19.09.07 12:42 
Danke,

habe den Fehler selber gefunden nur um das abzuschließen, falls jemand anderns dieses Trad gbrauchen kann:

es muss
ausblenden Delphi-Quelltext
1:
and					


also:


ausblenden Delphi-Quelltext
1:
table1.filter:= 'archiv <>' +QuotedStr('Ja') and 'papierk <>' +QuotedStr('Ja');					


heißen. Das läßt sich dann auch beliebig erweitern.