Issue 107151

Summary: formula - if() construct not parsed correctly
Product: Calc Reporter: vladimir_p <vladimir.pachnik>
Component: codeAssignee: kla <thomas.klarhoefer>
Status: CLOSED FIXED QA Contact: issues@sc <issues>
Severity: Trivial    
Priority: P3 CC: dtardon, issues, rb.henschel
Version: OOO310m9Keywords: oooqa, regression
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: PATCH Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 99999    
Attachments:
Description Flags
TESTCASE
none
testcase with fewer terms
none
pop used ScEmptyCellToken in Compare() none

Description vladimir_p 2009-11-23 18:12:07 UTC
Hello

In attached testcase document three varieties of a formula are presented
employing the following schema:

={:numeric_value_a:} - IF({:test:};{:then numeric_value_b:};{:else numeric_value_c})

namely

={:value_a:}-IF(HLOOKUP($cell;$range;$position;$sorted)="";{:then
numeric_value_b:};{:else numeric_value_c})

and

={:value_a:}-IF(ISBLANK(HLOOKUP($cell;$range;$position;$sorted));{:then
numeric_value_b:};{:else numeric_value_c})


The former wording is not giving correct results under OOO310m9 (verified with
HLOOKUP & VLOOKUP cases) although it was used in OOo 2.x without problems.

Please  see the highlighted cells in the attached testcase for further explanation.

Regards
Vladimir
Comment 1 vladimir_p 2009-11-23 18:12:56 UTC
Created attachment 66299 [details]
TESTCASE
Comment 2 Regina Henschel 2009-11-23 19:47:03 UTC
I can confirm it for OOo3.2 m5 on WinXP.

I have reduced the problem in the attached file.

There in cell C14 the term
HLOOKUP(C6;B1:C4;4;1)=""
evaluates to TRUE

and therefore in cell C15 the term
=IF(HLOOKUP(C6;B1:C4;4;1)="";999;555)
evaluates to 999

But in cell c16 the term
=10-IF(HLOOKUP(C6;B1:C4;4;1)="";999;555)
does not evaluate to -989.

You get the same error for all operators + - * / ^
In all cases the number 10 is treated as zero.

The error occurs only in the structure "number - IF" but not in "IF - number".
Comment 3 Regina Henschel 2009-11-23 19:48:29 UTC
Created attachment 66300 [details]
testcase with fewer terms
Comment 4 niklas.nebel 2009-11-24 12:50:54 UTC
taking over
Comment 5 dtardon 2009-11-24 13:56:45 UTC
Created attachment 66317 [details]
pop used ScEmptyCellToken in Compare()
Comment 6 niklas.nebel 2009-11-24 14:10:22 UTC
dtardon, CompareMat needs the same. Otherwise, yes, that was the problem.

It's fixed in CWS "calc32stopper6", svn rev. 277610.
Comment 7 niklas.nebel 2009-11-26 12:50:04 UTC
reassigning to QA for verification
Comment 8 kla 2009-12-04 13:48:06 UTC
I take it for verification.
Comment 9 kla 2009-12-07 16:17:22 UTC
Verified by using reginas sample. Thx for it.
Comment 10 dtardon 2010-04-22 13:00:38 UTC
integrated in OOO320_m8/DEV300_m68