Forum > LazReport

LazReport: Error using HideZeroValues with formula including more variables

(1/1)

luca:
Hi,
I found this problem setting HideZeroValues to true.

The procedure:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TfrReport.GetVariableValue(const s: String; var aValue: Variant);in LR_Class checks the status of the flag for every variable in the formula using the code below:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  //check if CurView is TfrBandView to avoid clash with flBandPrintChildIfNotVisible. Issue 29313  if Assigned(CurView) and ((CurView.Flags and flHideZeros <> 0) and not (CurView is TfrBandView)) then  begin    if TVarData(aValue).VType in [varSmallInt, varInteger, varCurrency,       varDecimal, varShortInt, varByte, varWord, varLongWord, varInt64,       varQWord, varDouble, varSingle] then    begin      if aValue = 0 then        aValue:=Null;    end;  end;    
If one variable has zero value the procedure return Null.
This provokes an error in the formula calculation resulting in a report not completely created.
I found a workround by commenting the code above and inserting the code below in the procedure (dummy is an integer variable)

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TfrCustomMemoView.ExpandVariables;var... dummy:integer;...   for i := 0 to Memo.Count - 1 do  begin    s := Memo[i];    if Length(s) > 0 then    begin      GetData(s);//NEW CODE      if Assigned(CurView) and ((CurView.Flags and flHideZeros <> 0) and not (CurView is TfrBandView)) then       if TryStrToInt(s,dummy) then if dummy=0 then s:='';//END OF NEW CODE      Memo1.Add(s)    end    else      Memo1.Add('');  end; --- 
This work in my case BUT I'm not sure this is the correct way to fix the problem.

Regards

Navigation

[0] Message Index

Go to full version