Topic: Incremental search issue

Incremental  search doesn't seems to be working when using Derek's showing details without SQL method.


Please see the attached sample project below:

Post's attachments

Attachment icon Showing DetWithout SQL 4 Two Grids_withSearch.zip 12.4 kb, 352 downloads since 2017-08-04 

Adam
God... please help me become the person my dog thinks I am.

Re: Incremental search issue

Hi Adam,
I just did a 'clear search fields' when you first run the application and a dbupdate.  Does this fix it?
Derek.

Post's attachments

Attachment icon Showing DetWithout SQL 4 Two Grids_withSearch.zip 345.74 kb, 351 downloads since 2017-08-05 

Re: Incremental search issue

Hi Derek,

Thank you very much...............

However, inc search prevents browsing tGrid records properly.
I added clear under mouse click and keyup but didn't work.

Adam
God... please help me become the person my dog thinks I am.

Re: Incremental search issue

Don't mean to step on your toes Derek. I had a couple of minutes to look at the project.  Adam, I think the problem lies with the ShowRecord on your hidden buttons plus the fields at the bottom of the form being directly linked to the database table. The ShowRecord is populating the fields at the bottom of each of the tabsheets as well as the search fields and that's what is messing up the tablegrid displays as you mentioned with incremental searches. I removed the linking of the fields to the table. I also removed the ShowRecord action from the hidden buttons and replaced it with script to populate the fields at the bottom of the tabsheets with the entries in the respective tablegrid. Hopefully I'm on target with the problem and solution for you.


Derek, if you have another way, by all means include it. I know there is usually more than one way to solve things in MVD.

Post's attachments

Attachment icon Showing DetWithout SQL 4 Two Grids_withSearch 2.zip 592.49 kb, 342 downloads since 2017-08-05 

Re: Incremental search issue

Thank you very much EHW....................................
Your kind help is always appreciated.........................


There is one issue I could notice.
When added new record without date (DOB) it would return error saying something like '' not valid date on tGrid record browsing.


I have commented outI your date SQL line:

//Form1.DateTimePicker2.DateTime := StrToDate(Form1.GridEmployees.Cells[2,Form1.GridEmployees.SelectedRow]);

then added the following SQL to mouse click, key up and highlight grid row in each tabsheet sections to get rid of the error:

procedure Form1_GridEmployees_OnClick (Sender: string); //*** do when using mouse on employee grid
var s: string;
begin
  derekwhichsheetisactive;

  s := SQLExecute('SELECT dateofbirth FROM Employees WHERE id='+Form1.GridEmployees.sqlValue);
    if s <> '' then Form1.DateTimePicker2.Date := SQLDateTimeToDateTime (s)
    else Form1.DateTimePicker2.Checked := False;
end;

Somehow my approach looks messy. I tried to play around with your date SQL line but couldn't get it working.

Adam
God... please help me become the person my dog thinks I am.

Re: Incremental search issue

Adam,

Your way is fine. If you wanted to use my line then you can precede it with the following


If Form1.GridEmployees.Cells[2,Form1.GridEmployees.SelectedRow] = '' then
      Form1.DateTimePicker2.Checked := False else

Since the fields being populated are disabled, an alternative and probably the way I would go is to define the date field as text. Then it doesn't matter if it's empty or not. The you could replace my line with the following.


Form1.edDOB.Text := Form1.GridEmployees.Cell,Form1.GridEmployees.SelectedRow];

I put both ways in the attached.

Post's attachments

Attachment icon Showing DetWithout SQL 4 Two Grids_withSearch 3.zip 592.53 kb, 376 downloads since 2017-08-05 

Re: Incremental search issue

Thank you very much EHW..................... Truly appreciated...................


As you mentioned populated fields are disabled, therefore I also prefer your one line text field approach.
Additionally thank you for offering two approaches. Something to learn from for me.


Since we are not using show records via hidden button fully, I took out clear search fields on form1 show.

Adam
God... please help me become the person my dog thinks I am.