Bug 40590 - Formulas stored as defined names "lost" when spreadsheet opens
Summary: Formulas stored as defined names "lost" when spreadsheet opens
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.4.3 release
Hardware: x86 (IA32) Windows (All)
: medium critical
Assignee: Eike Rathke
URL:
Whiteboard: target:3.5.0 target:3.4.6
Keywords: regression
: 42745 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-09-02 16:57 UTC by Bruce Leary
Modified: 2012-02-08 13:38 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Spreadsheet that demonstrates the bug. (16.78 KB, application/vnd.oasis.opendocument.spreadsheet)
2011-09-02 16:58 UTC, Bruce Leary
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bruce Leary 2011-09-02 16:57:03 UTC
I have attached a spreadsheet that demonstrates the problem.

1) Open the attached spreadsheet that contains formulas stored as defined names.  

2) Note that cell E4 displays #NAME?.

3) Ctrl-F3 to open the defined names window and examine defined name "ElecUsageKW".  Note that the Assigned To field contains a valid formula.

4) Highlight and copy the formula.  Then click Delete.  (note: you cannot click modify as that will crash 3.4.3.  A separate bug report was submitted about that problem which is not related to the subject of this bug)

5) Immediately paste the saved formula back into the Assigned To field and then click Add.

6) Click OK and note that cell E4 now displays the correct value value of 1682.  

7) Resave the spreadsheet.  

8) Close the spreadsheet.

9) The next time the spreadsheet is opened the problem will be the same as above.

I have not been able to find a work-around to this problem.  This was not a problem in 3.4.2.  It is new to 3.4.3.
Comment 1 Bruce Leary 2011-09-02 16:58:34 UTC
Created attachment 50852 [details]
Spreadsheet that demonstrates the bug.
Comment 2 GerardF 2011-09-04 10:45:03 UTC
Same as https://bugs.freedesktop.org/show_bug.cgi?id=40378

*** This bug has been marked as a duplicate of bug 40378 ***
Comment 3 Eike Rathke 2011-09-04 11:27:33 UTC
(In reply to comment #0)
> 4) Highlight and copy the formula.  Then click Delete.  (note: you cannot click
> modify as that will crash 3.4.3.  A separate bug report was submitted about
> that problem which is not related to the subject of this bug)

Which bug ID?
Comment 4 Bruce Leary 2011-09-04 11:33:50 UTC
(In reply to comment #3)
> (In reply to comment #0)
> > 4) Highlight and copy the formula.  Then click Delete.  (note: you cannot click
> > modify as that will crash 3.4.3.  A separate bug report was submitted about
> > that problem which is not related to the subject of this bug)
> 
> Which bug ID?

40571.
Comment 5 Eike Rathke 2011-09-04 12:34:03 UTC
The cause of #NAME? was fixed with bug 40378 in master.
Comment 6 Bruce Leary 2011-09-04 14:47:47 UTC
(In reply to comment #5)
> The cause of #NAME? was fixed with bug 40378 in master.

I downloaded and installed 
master~2011-09-02_14.25.52_LibO-Dev_OOO350m1_Win_x86_install_en-US.exe 
and it did appear to partially fix the problem.  Unfortunately, that version breaks several other things in the spreadsheet so I just uninstalled it and went back to 3.4.2 which does not have the problem.

Perhaps the next release will fix this without breaking anything else.
Comment 7 Bruce Leary 2011-09-07 09:47:04 UTC
The fix implemented by bug 40378, which this bug was marked as a DUPL of, does not completely correct this problem.  The problem as indicated by the originally attached spreadsheet is fixed but a different formula stored as a defined name in the complete spreadsheet fails.  This was determined by testing with master master~2011-09-06_02.34.59_LibO-Dev_OOO350m1_Win_x86_install_en-US.exe.  The defined name formula problem created by the fix (or not corrected as a result of an incomplete fix) is that double quotes are removed from formulas stored as defined names when the spreadsheet is opened.


Original defined name value:
IF(ElecUsage<>"",VLOOKUP(BillingDate,GasRates,3)*GasUsage/10+VLOOKUP(BillingDate,GasRates,2)),"")

Valued of defined name after spreadsheet loads:
IF(ElecUsage<>,VLOOKUP(BillingDate,GasRates,3)*GasUsage/10+VLOOKUP(BillingDate,GasRates,2)),)

Notice that the Double Quotes that are supposed to be following the <> in the initial element of the formula are gone.  Also the double quotes at the end of the formula are gone.  If I replace these in the formula and do a modify (which now works thanks for the fix to 40571) the formula processes correctly until the spreadsheet is saved and reloaded.
Comment 8 Eike Rathke 2011-09-07 10:03:50 UTC
Thanks for noticing.
For the records: the name in question is ElecCalcProjected, also other ElecCalc* names that use similar formulas are affected.
I'll take a look at this.
Comment 10 Bruce Leary 2011-11-12 04:33:37 UTC
This problem still exists in 3.4.4.  See bug 42745.
Comment 11 Eike Rathke 2011-11-14 02:03:21 UTC
*** Bug 42745 has been marked as a duplicate of this bug. ***
Comment 12 Bruce Leary 2011-11-14 05:06:47 UTC
This bug has been marked as RESOLVED FIXED.  The definitions of those words is subject to interpretation.  As it turns out, the fix will not be included until at least release 3.5.0.  The bug was introduced in 3.4.3.  3.4.2 worked correctly.  3.4.3 created the problem.  The fix is now stated as being too invasive to include in 3.4.4 or 3.4.5.  

Amazing.  They broke it in 3.4.3 but the fix is "too invasive" to be implemented until 3.5.0 at the earliest.  

With this operating philosophy I don't believe that anyone should consider LibreOffice for use in a true production environment if your software maintenance policy embraces the concept of installing incremental fix releases.

See bug 42745 for more.
Comment 14 Eike Rathke 2012-02-08 13:38:05 UTC
For completeness: also needed due to the split repos on 3-4: http://cgit.freedesktop.org/libreoffice/libs-core/commit/?h=libreoffice-3-4&id=a61057eb182d680eefaa996c0b4cd13ba4bdfcc0