You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2016/01/01 16:55:33 UTC

[Issue 126758] CURRENT() only evaluates first occurrence

https://bz.apache.org/ooo/show_bug.cgi?id=126758

Wolfgang Jäger <ja...@psilosoph.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jag@psilosoph.de

--- Comment #1 from Wolfgang Jäger <ja...@psilosoph.de> ---
As of 2011-09-29 the relevant specification concerning the evaluator for Calc
is http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part2.odt. It
does not mention a function CURRENT. 
Thus implementing such a function must be based on the general clauses C) and
should obey the requirements of D) in the subchapter "2.3.1 OpenDocument
Formula Evaluator" of the above linked in document. 
Can someone point to the "clear{ly} document" concerning this extension? The
best I could find is the Help text (quoted from AOO V4.1.2): 
"
CURRENT
This function returns the result to date of evaluating the formula of which it
is a part (in other words the result as far as that evaluation has got). Its
main use is together with the STYLE() function to apply selected styles to a
cell depending on the cell content.
Syntax
CURRENT()
Example
=1+2+CURRENT()
The example returns 6. The formula is calculated from left to right as: 1 + 2
equals 3, giving the result to date when CURRENT() is encountered; CURRENT()
therefore yields 3, which is added to the original 3 to give 6.
=A2+B2+STYLE(IF(CURRENT()>10;"Red";"Default"))
The example returns A2 + B2 (STYLE returns 0 here). If this sum is greater than
10, the style Red is applied to the cell. See the STYLE function for more
explanation.
="choo"&CURRENT()
The example returns choochoo.
"
Obviously this can only apply to an evaluation using exactly one accumulator
and not needing any postponing of operations. Only the second example of the
Help text may assure that the previously calculated partial result must still
be accessible when a condition is started to evaluate. Changing it into 
=A2+B2+STYLE(IF(10<CURRENT();"Red";"Default")) will change the result, and we
should expect that. We have a very fragile situation and even the second
example of the above mentioned Help depends on not initialising the accumulator
anew when the partial result is pushed on the stack (supposed things are
roughly done this traditional way).
To get it a bit clearer suspend using logical expressions, and try:
=5*(CURRENT()+2)
=5*(2+CURRENT())
=5*(CURRENT()+2+CURRENT())

I could not find an AOO documentation containing more detail (or in fact
something at all). (The most recent LibO CalcGuide simply puts it this way:
"CURRENT() Calculates the current value of a formula at the actual position.")

In consequence we should not judge the reported behaviouir a bug. We have
instead a serious flaw concerning specification and documentation - and a
possibly too rash implementation of an extension.

-- 
You are receiving this mail because:
You are the assignee for the issue.