Exception E4003: Invalid fractional number on calculate

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
AllanGMorris
Posts: 5
Joined: Sat Dec 13, 2014 9:56 pm

Exception E4003: Invalid fractional number on calculate

Post by AllanGMorris »

Hi,

I have a multi-threaded application which reads a series of CSV's (sometimes the same file in separate threads) , does some calcs and propagates results to oracle db.

I am receiving E4003 exception when I am setting the asformularef to the required formula The exception does not occur everytime I run the app (but once it is raised it always raises the exception) which leads me to believe it is something associated with Multi threading? Any advice on the exception or how /what circumstances it will occur will be greatly appreciated.
The formula is quite straight forward. if(c97="XX","TRUE","FALSE")

Thanks
Allan

Code: Select all

Constructor TExcelAlt.CreateText(asFile: String; asDelimiter: string);
begin
  try
    FoActiveWB := TXLSReadWriteII5.create(Nil);
    FoActiveWB.Filename := asFile;
      importCSV(foActiveWb, 0, 0, 0, asfile, asdelimiter[1], true) ;
    } except
    on e: Exception do
    begin
      showmessage('Exception detected in WorkBook [' + e.Message + ']');
    end;
  end;
  Reset;
end;
function TExcelAlt.calcCellRef(aoWS: string; asCalcref: String;asCalc: String): String;
var
sheet: TXLSWorksheet;
calcres:string;
calcdata:string;
begin
  try
    if aows = '' then
       sheet:=FoActiveWB.sheets[0]
    else
      sheet := FoActiveWB.sheets[getWS(aoWS)];
  calcdata:= uppercase(ascalcref);
    sheet.AsFormularef[asCalcref]:=uppercase(ascalc);
     FoActiveWB.calculate;
      calcres := sheet.asstringref[uppercase(ascalcref)];
    result:=calcres;

  except
    on e: Exception do
    begin
      Result := '';
     end;
  end;

Post Reply