Browse Source

* Fix null values conversion

git-svn-id: trunk@38439 -
michael 7 years ago
parent
commit
11ac4739b4
1 changed files with 17 additions and 9 deletions
  1. 17 9
      packages/fcl-report/src/fpreport.pp

+ 17 - 9
packages/fcl-report/src/fpreport.pp

@@ -9543,18 +9543,26 @@ procedure TFPReportDataField.GetRTValue(Var Result: TFPExpressionResult;
   procedure SetResult(const pValue: Variant);
   procedure SetResult(const pValue: Variant);
   begin
   begin
     if Assigned(FExprIdentierDef) then
     if Assigned(FExprIdentierDef) then
-      case FExprIdentierDef.ResultType of
-        rtBoolean:    Result.ResBoolean   := pValue;
-        rtInteger:    Result.ResInteger   := pValue;
-        rtFloat:      Result.ResFloat     := pValue;
-        rtDateTime:   Result.ResDateTime  := pValue;
-        rtString:     Result.ResString    := pValue;
-      end;
+      if varIsNull(pValue) then
+        case FExprIdentierDef.ResultType of
+          rtBoolean:    Result.ResBoolean   := False;
+          rtInteger:    Result.ResInteger   := 0;
+          rtFloat:      Result.ResFloat     := 0.0;
+          rtDateTime:   Result.ResDateTime  := 0.0;
+          rtString:     Result.ResString    := '';
+        end
+      else
+        case FExprIdentierDef.ResultType of
+          rtBoolean:    Result.ResBoolean   := pValue;
+          rtInteger:    Result.ResInteger   := pValue;
+          rtFloat:      Result.ResFloat     := pValue;
+          rtDateTime:   Result.ResDateTime  := pValue;
+          rtString:     Result.ResString    := pValue;
+        end;
   end;
   end;
 
 
 begin
 begin
-  if Assigned(FOnGetUsePrevValue) and
-  FOnGetUsePrevValue() then
+  if Assigned(FOnGetUsePrevValue) and FOnGetUsePrevValue() then
     SetResult(FPrevValue)
     SetResult(FPrevValue)
   else
   else
     SetResult(FValue);
     SetResult(FValue);