Change in core[master]: fdo#56124 add calc functions IFERROR and IFNA as in ODFF1.2

Winfried Donkers W.Donkers at dci-electronics.nl
Sun Dec 9 06:07:46 PST 2012


Hi Eike

> > To finally find out what goes wrong, I copied the contents of SCIfJump() into
> > ScIfError(), made ocIfError do the same as ocIf (except in lotus/excel filter
> > files) and gave IFERROR() 3 arguments (just as IF()).
> > It still doesn't work: IFERROR(X;Y;Z) always returns Y, regardless of the value
> > of X. That is, if X produces an error (or Y, or Z), the error is returned.

>Could it be that you didn't implement the special handling in the
compiler and tokens? ...

I did an opengrok search for ocIf and changed all files, including sxfunc.src (to give iferror 3 parameters).
The only differences that I know of between IF() and IFERROR() are the function names and the group to which the functions belong.

When in the switch statement in ScIfError()/ScIfJump() (in /core/sc/source/core/tool/interpr1.cxx)
        default:
        {
            if ( GetBool() )   <<-- here
            {   // TRUE
                if( nJumpCount >= 2 )

I replace GetBool() with getDouble() and look at its value, it is 3 in case of IFERROR() and 0 in case of IF().
(in calc I entered IFERROR(0;2;3), result 2 and IF(0;2;3), result 3).

Winfried


More information about the LibreOffice mailing list