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
_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice