https://bugs.documentfoundation.org/show_bug.cgi?id=111675
Eike Rathke <er...@redhat.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |NEW
Summary|UI: Functions IFS does not |IFS() and SWITCH() should
|work together with function |short-cut evaluation like
|CURRENT |IF() and CHOOSE()
--- Comment #10 from Eike Rathke <er...@redhat.com> ---
I'm repeating myself:
"IFS() evaluates conditions until it finds a matching one, sprinkling CURRENT()
all over makes it depend on internal behaviour what arguments will be evaluated
first, which currently may be all before IFS() is called and in future may be
only the ones until one is matched."
and
"Using CURRENT() multiple times at the same function level within one
expression means relying on internal implementation details. One should not. It
may change without notice."
> =B2+STYLE(IFS(CURRENT()<B3;"Grün";CURRENT()=B3;"Gelb";CURRENT()>B3;"Rot"))
>
> And my question is: For B3 constantly being e.g. "4", how could a value of
> "4" for B2 lead to the condition "CURRENT()>B3" being selected by IFS() ???
Because here the state of CURRENT is not what you think it is. For the first
CURRENT()<B3 it is B2 that was previously pushed to the stack, for CURRENT()=B3
it is "Grün" that was just pushed on the stack, for CURRENT()>B3 it is "Gelb"
that was just pushed on the stack, and a string is greater than a numeric
value.
Anyway, I'll keep this and close bug 113595 instead, they have the same reason.
IFS() and SWITCH() currently evaluate all parameters' arguments in order
encountered from left to right for IFS() and right to left for SWITCH() and
return the result matching for the condition(s). They do not short-cut
evaluation like IF() and CHOOSE() do. Hence for a function that has side
effects like STYLE() all styles are applied and the last one evaluated wins.
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs