Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Datenbanken (https://www.delphipraxis.net/15-datenbanken/)
-   -   DBGrid filtering (https://www.delphipraxis.net/169829-dbgrid-filtering.html)

danten 14. Aug 2012 16:13

Datenbank: Absolute database • Version: 2011 • Zugriff über: SQL

DBGrid filtering
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hi friends,
I need the DBGrid display only records from the "A" to "D".

Thanks

himitsu 14. Aug 2012 16:36

AW: DBGrid filtering
 
Delphi-Referenz durchsuchenTDataSet.Filter + Delphi-Referenz durchsuchenTDataSet.Filtered

Oder bei "besseren" Komponenten ala DevExpress, da gibt es auch noch eine zusätzliche Filterung im Grid/DataControler, welche man nutzen könnte.

danten 14. Aug 2012 18:14

AW: DBGrid filtering
 
Zitat:

Zitat von himitsu (Beitrag 1178264)
Delphi-Referenz durchsuchenTDataSet.Filter + Delphi-Referenz durchsuchenTDataSet.Filtered

Oder bei "besseren" Komponenten ala DevExpress, da gibt es auch noch eine zusätzliche Filterung im Grid/DataControler, welche man nutzen könnte.

OK,here is a possibility of something like Uppercase and Lowercase, as well as the ability to input QuotedStr array [a..d]?
Delphi-Quellcode:
with dm.ds_distributor.DataSet do begin
    Filtered := False;
    Filter := 'Firma = ' + QuotedStr(Uppercase('A')) + ' OR ' +
  'Firma = ' + QuotedStr(Uppercase('D')) + ' OR ' +
  'Firma = ' + QuotedStr(Lowercase('A')) + ' OR ' +
  'Firma = ' + QuotedStr(Lowercase('D'));
    Filtered := True;
end;;
Thanks

DeddyH 14. Aug 2012 19:14

AW: DBGrid filtering
 
Alternatively you could use a Query-Component with a SQL-Statement like this:
SQL-Code:
SELECT
  <Fieldlist>
FROM
  <your table>
WHERE
  UPPER(Firma) IN ('A', 'B', 'C', 'D')

Bummi 14. Aug 2012 20:26

AW: DBGrid filtering
 
I'd prefer SQL, but perhaps you would prefer the Event OnFilterRecord

danten 15. Aug 2012 06:03

AW: DBGrid filtering
 
Zitat:

Zitat von Bummi (Beitrag 1178286)
I'd prefer SQL, but perhaps you would prefer the Event OnFilterRecord

SQL:

Delphi-Quellcode:
SELECT *
FROM distributor
WHERE Firma >='A' AND Firma <'D'
I am interested in the possibility onFilterRecord.

Furtbichler 15. Aug 2012 06:37

AW: DBGrid filtering
 
Then RTFM and find out. It seems as if you always want us to do the work.
Implementing an OnFilterRecord-Event is as simple as posting a question here.

Go on!

mkinzler 15. Aug 2012 06:41

AW: DBGrid filtering
 
Zitat:

Implementing an OnFilterRecord-Event is as simple as posting a question here.
If you know about basics. But that seems a great donot these days.

Furtbichler 15. Aug 2012 07:55

AW: DBGrid filtering
 
Hmmm.
Entering the Eventname plus 'example' in Google and press 'search'? Easy.
Read the examples? Easy.
Open Delphi and load the project? Easy.
Find the event in the objectinspector? Easy.
Doubleclick? Easy.
Adapt the example found in google? ...

danten 15. Aug 2012 08:23

AW: DBGrid filtering
 
Zitat:

Zitat von Furtbichler (Beitrag 1178312)
Hmmm.
Entering the Eventname plus 'example' in Google and press 'search'? Easy.
Read the examples? Easy.
Open Delphi and load the project? Easy.
Find the event in the objectinspector? Easy.
Doubleclick? Easy.
Adapt the example found in google? ...

Write an example here is easy, but for you a problem.:roll:
Delphi-Quellcode:
 with dm.ds_distributor.DataSet do begin
    Filtered := False;
    Filter := 'Firma <> ' + QuotedStr('A') + ' AND ' +
  'Firma <= ' + QuotedStr('D');
    Filtered := True;
end;
That's what I needed without google ....


Alle Zeitangaben in WEZ +1. Es ist jetzt 19:18 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz