Explorar el Código

* Fix null values conversion

git-svn-id: trunk@38439 -
michael hace 7 años
padre
commit
11ac4739b4
Se han modificado 1 ficheros con 17 adiciones y 9 borrados
  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);