Error on filtering Null values locally
Posted: Wed 15 Oct 2014 08:11
We wanted to filter a SmartQuery locally, so we set a filter expression like 'UPPER(MyColumn) like UPPER(MyValue)'.
When it comes to null values in the Column "MyColumn" an
“Could not convert variant of type (Null) into type (OleStr)” exception raises.
As we debugged, it seems the error occurs in MemData.pas in
between the lines 5807 and 5813:
So if the field value is a null value the AnsiLowerCase statement trys to convert and the described error occurs. I believe a simple AnsiLowerCase(VarToStr(V1)) instead of AnsiLowerCase(V1) could fix the problem.
When it comes to null values in the Column "MyColumn" an
“Could not convert variant of type (Null) into type (OleStr)” exception raises.
As we debugged, it seems the error occurs in MemData.pas in
Code: Select all
function TData.Eval(Node: TExpressionNode): boolean;Code: Select all
if (Node.LeftOperand.NodeType in [ntField, ntValue]) and Assigned(Node.LeftOperand.LeftOperand) then
case Node.LeftOperand.LeftOperand.NodeType of
ntLower:
V1 := AnsiLowerCase(V1);
ntUpper:
V1 := AnsiUpperCase(V1);
end;