Icon View Incident Report

Serious Serious
Reported By: Paul Coshott
Reported On: 10/12/2017
For: Version 2.26 Build 4
# 4585 Using Only Multiple Wildcard (%) Characters in LIKE Expressions Causes Blank Values to be Excluded

I have what I think will be a simple question, but I’m not sure how to re-write the query or the code that runs the query. I am using Elevate DB with EWB. The query I currently have is as follows.

When I fill in any of the edits that provide the values for the query, the query works perfectly – but only if the record has something in all the fields mentioned in the query. If for instance, the drivers license is blank, the query does not pick up the record. The % wildcards in the following code, seem to pickup anything so long as it’s not blank.

The Search button contains the following code:

 with qCliSearch do begin
   Params.Clear;
   Params.Add('Surname=' + QuotedStr('%' + eSurname.Text + '%'));
   Params.Add('FirstName=' + QuotedStr('%' + eFirst.Text + '%'));
   Params.Add('Drivers_License=' + QuotedStr('%' + eDriversLic.Text + '%'));
   Params.Add('Passport_No=' + QuotedStr('%' + ePassport.Text + '%'));
   if eDOB.Text <> '' then begin
     sDate := ADateStr(eDOB.SelectedDate);  //formats and quotes the date as ‘2000-01-31’
     Params.Add('startDOB=' + sDate);
     Params.Add('endDOB=' + sDate);
   end;
   Database.LoadRows(qCliSearch);
 end;

SELECT * FROM Clients
WHERE (FirstName LIKE {FirstName=''}) 
 AND (Surname LIKE {Surname=''})
 AND (Drivers_License LIKE {Drivers_License=''})
 AND (Passport_No LIKE {Passport_No=''})
 AND (DateOfBirth >= DATE{startDOB='1900-1-1'})
 AND (DateOfBirth <= DATE{endDOB='2100-1-1'})



Comments Comments and Workarounds
The workaround is to only use a single wildcard character ('%') when trying to match on all values.


Resolution Resolution
Fixed Problem on 10/12/2017 in version 2.26 build 5


Products Affected Products Affected
ElevateDB Additional Software and Utilities
ElevateDB DAC Client-Server
ElevateDB DAC Client-Server with Source
ElevateDB DAC Standard
ElevateDB DAC Standard with Source
ElevateDB DAC Trial
ElevateDB LCL Standard with Source
ElevateDB PHP Standard
ElevateDB PHP Standard with Source
ElevateDB PHP Trial
ElevateDB VCL Client-Server
ElevateDB VCL Client-Server with Source
ElevateDB VCL Standard
ElevateDB VCL Standard with Source
ElevateDB VCL Trial

Image