- Posts: 25
- Thank you received: 0
- Forum
- CodeTyphon Studio
- CodeTyphon Studio Components and Libraries
- Database Development
- Filtering dataset not working CT6.8 - Firebird 3
×
Components and Libraries for Database Development, discussions, problems and suggestions
Question Filtering dataset not working CT6.8 - Firebird 3
- Jose Ceravolo
- Topic Author
- Offline
- Junior Member
-
Less
More
2 years 9 months ago #13677
by Jose Ceravolo
Filtering dataset not working CT6.8 - Firebird 3 was created by Jose Ceravolo
Hi All,
I am new to CT and I have a procedure that sets up a filter in a dataset.
It works in Delphi, but I can't get to work with CT.
The filter is UPPER(NAME) like '%C%'.
That should return any NAME that contains a C character in it.
Thanks in advance,
Jose.
I am new to CT and I have a procedure that sets up a filter in a dataset.
It works in Delphi, but I can't get to work with CT.
The filter is UPPER(NAME) like '%C%'.
That should return any NAME that contains a C character in it.
Thanks in advance,
Jose.
Please Log in or Create an account to join the conversation.
- Sternas Stefanos
-
- Offline
- Moderator
-
- Ex Pilot, M.Sc, Ph.D
2 years 9 months ago #13678
by Sternas Stefanos
PilotLogic Architect and Core Programmer
Replied by Sternas Stefanos on topic Filtering dataset not working CT6.8 - Firebird 3
Thanks Sir
First of all we don't use Delphi.
Please give us more info:
Your OS, a code sample.
etc
First of all we don't use Delphi.

Please give us more info:
Your OS, a code sample.
etc
PilotLogic Architect and Core Programmer
Please Log in or Create an account to join the conversation.
- Jose Ceravolo
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 25
- Thank you received: 0
2 years 9 months ago #13680
by Jose Ceravolo
Replied by Jose Ceravolo on topic Filtering dataset not working CT6.8 - Firebird 3
Hello Sternas,
I am using Windows 10.
Here's the code:
procedure TfrmDataBrowser.btApplyClick(Sender: TObject);
begin
if dsData.DataSet.FieldByName(lcFilter) is TStringField then
begin
dsData.DataSet.Filter := 'UPPER(' + lcFilter + ') like ' + quotedstr('%' + uppercase(edtSearch.Text) + '%');
end
else dsData.DataSet.Filter := lcFilter + ' = ' + edtSearch.Text;
dsData.DataSet.Filtered := true;
edtSearch.SelectAll;
edtSearch.SetFocus;
end;
I am using Windows 10.
Here's the code:
procedure TfrmDataBrowser.btApplyClick(Sender: TObject);
begin
if dsData.DataSet.FieldByName(lcFilter) is TStringField then
begin
dsData.DataSet.Filter := 'UPPER(' + lcFilter + ') like ' + quotedstr('%' + uppercase(edtSearch.Text) + '%');
end
else dsData.DataSet.Filter := lcFilter + ' = ' + edtSearch.Text;
dsData.DataSet.Filtered := true;
edtSearch.SelectAll;
edtSearch.SetFocus;
end;
Please Log in or Create an account to join the conversation.
- Sternas Stefanos
-
- Offline
- Moderator
-
- Ex Pilot, M.Sc, Ph.D
2 years 9 months ago - 2 years 9 months ago #13681
by Sternas Stefanos
PilotLogic Architect and Core Programmer
Replied by Sternas Stefanos on topic Filtering dataset not working CT6.8 - Firebird 3
Try this
procedure TfrmDataBrowser.btApplyClick(Sender: TObject);
begin
dsData.DataSet.Filtered := true;
if dsData.DataSet.FieldByName(lcFilter) is TStringField then
begin
dsData.DataSet.Filter := 'UPPER(' + lcFilter + ') like ' + quotedstr('%' + uppercase(edtSearch.Text) + '%');
end
else dsData.DataSet.Filter := lcFilter + ' = ' + edtSearch.Text;
edtSearch.SelectAll;
edtSearch.SetFocus;
end;
PilotLogic Architect and Core Programmer
Last edit: 2 years 9 months ago by Sternas Stefanos.
Please Log in or Create an account to join the conversation.
- Jose Ceravolo
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 25
- Thank you received: 0
2 years 9 months ago #13683
by Jose Ceravolo
Replied by Jose Ceravolo on topic Filtering dataset not working CT6.8 - Firebird 3
It's the same, it does not return any records.
It still works for integer fields.
It still works for integer fields.
Please Log in or Create an account to join the conversation.
- Sternas Stefanos
-
- Offline
- Moderator
-
- Ex Pilot, M.Sc, Ph.D
2 years 9 months ago - 2 years 9 months ago #13684
by Sternas Stefanos
PilotLogic Architect and Core Programmer
Replied by Sternas Stefanos on topic Filtering dataset not working CT6.8 - Firebird 3
My suggestion is
to attach here a test project
to attach here a test project
procedure TfrmDataBrowser.btApplyClick(Sender: TObject);
begin
dsData.DataSet.Filtered := true;
dsData.DataSet.Refresh;
if dsData.DataSet.FieldByName(lcFilter) is TStringField then
begin
dsData.DataSet.Filter := 'UPPER(' + lcFilter + ') like ' + quotedstr('%' + uppercase(edtSearch.Text) + '%');
end
else dsData.DataSet.Filter := lcFilter + ' = ' + edtSearch.Text;
edtSearch.SelectAll;
edtSearch.SetFocus;
end;
PilotLogic Architect and Core Programmer
Last edit: 2 years 9 months ago by Sternas Stefanos.
Please Log in or Create an account to join the conversation.
- Jose Ceravolo
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 25
- Thank you received: 0
2 years 9 months ago #13685
by Jose Ceravolo
Replied by Jose Ceravolo on topic Filtering dataset not working CT6.8 - Firebird 3
Ok, I created a working test project.
The idea is to click on the title of the grid to be able to search that field.
It works with the integer field.
The idea is to click on the title of the grid to be able to search that field.
It works with the integer field.
Attachments:
Please Log in or Create an account to join the conversation.
- Sternas Stefanos
-
- Offline
- Moderator
-
- Ex Pilot, M.Sc, Ph.D
2 years 9 months ago #13688
by Sternas Stefanos
PilotLogic Architect and Core Programmer
Replied by Sternas Stefanos on topic Filtering dataset not working CT6.8 - Firebird 3
For which Firebird ver is your NEWDATABASE.FDB ?
PilotLogic Architect and Core Programmer
Please Log in or Create an account to join the conversation.
- Jose Ceravolo
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 25
- Thank you received: 0
2 years 9 months ago #13689
by Jose Ceravolo
Replied by Jose Ceravolo on topic Filtering dataset not working CT6.8 - Firebird 3
Firebird 3
Please Log in or Create an account to join the conversation.
- Jose Ceravolo
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 25
- Thank you received: 0
2 years 9 months ago #13692
by Jose Ceravolo
Replied by Jose Ceravolo on topic Filtering dataset not working CT6.8 - Firebird 3
I got it to work by replacing the % for *.
I wonder why that is. The % should work with Firebird.
Anyway, it's working, but it should not be like that.
Thanks,
Jose.
I wonder why that is. The % should work with Firebird.
Anyway, it's working, but it should not be like that.
Thanks,
Jose.
Please Log in or Create an account to join the conversation.
- Sternas Stefanos
-
- Offline
- Moderator
-
- Ex Pilot, M.Sc, Ph.D
2 years 9 months ago #13693
by Sternas Stefanos
PilotLogic Architect and Core Programmer
Replied by Sternas Stefanos on topic Filtering dataset not working CT6.8 - Firebird 3
Thanks Sir
have fun
have fun
PilotLogic Architect and Core Programmer
Please Log in or Create an account to join the conversation.