Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


Hi Eike,

With IFERROR and IFNA these situation should return an empty value to be compatible with Excel.
AFAIK also Excel does not allow a null argument for IFERROR() second parameter, but I'm not sure, 
I'd have to check.


Excel replaces an empty argument with an empty value, that is to say, the function description says 
'If value or value_if_error is an empty cell, IFERROR treats it as an empty string value ("").'
and =IFERROR(1/0;) returns an empty cell, not an error message.

With IF, the behaviour is described in ODFF1.2.
Note that there seems to be a typo in the spec, IfFalse is mentioned twice to be considered to be 
0, the first (two consecutive ;; case) probably should be IfTrue.

ODFF1.2 syntax is ' IF( Logical Condition [ ; [ Any IfTrue ] [ ; [ Any IfFalse ] ] ] )' and in 
semantics the handling of null arguments is described, but -IF(1;;) return an error in Calc.

My question is, where should this behaviour best be put in the code?

I think the right place would be ScInterpreter::Interpret() at the end where the final result is 
obtained. There's a check
    if( pCur->GetOpCode() == ocPush )
and if not an error is set. An ocMissing here could be propagated through to the ScFormulaResult, 
then
    bool isValue( formula::StackVar sv )
in sc/source/core/tool/formularesult.cxx would need to handle formula::svMissing as well, the 
ScFormulaResult::GetDouble() already returns 0.0 in such case.

I will try. The problem so far with SCInterpreter::Interpret was that I need to know what the 
function was, as IFERROR and IF have different responses to null arguments (in the case of IF I 
also need to know the values of the first argument as that is to be the result).

And as these functions are jump functions, how best to access/modify the stack or FormulaToken?
Don't ;-)
I won't ;-)

Winfried

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.