Created attachment 99362 [details] Document with test cases (code) to reproduce the problem, screen shots to clarigy the discussion, and further details regarding the behavior and the impact. Problem description: The “setFormula()” method in Calc appears to be broken. It will work for very simple formulas (e.g. “= 1”) but displays an “Err:508” in the cell for even slightly more complex formulas ( e.g. “=and(c2,e2)” ). I have tested this in both Linux and Windows environments and the problem occurs in both. Steps to reproduce: -- oCell.setFormula("= and(c2,e2)") will create an "Err:508" message -- see attached included document for additional information and examples. Current behavior: -- Using the setFormula() method will set the formula but in MOST cases will leave the cell showing a "Err:508" message. This can then lead to other very bad behavior. See the attached document for a further description and screen shots. Expected behavior: Working setFormula(). Operating System: All Version: 4.2.3.3 release
Please provide much simpler explanation. While we appreciate the extensive documentation - we have hundreds and hundreds of bugs to go through and having to read 4 pages of explanation is just too time consuming. Please just write a simple set of instructions (on the bug report itself) and attach the simplest test case you possibly can. Also, is this a regression or a new problem? Marking as NEEDINFO - once you provide much simpler steps and a much simpler test case, mark the bug as UNCONFIRMED and we'll try to confirm. Thanks for understanding - we truly to appreciate the effort you put into your explanation, just our volunteer teams are stretched much to thin to dedicate that much time to just reading about a single bug.
Below is an updated bug description along the lines that you requested. I have also answered the questions that you had in your comment. Please let me know if this meets your needs. I do not know of a way to modify the original bug description so I have added it here: Problem description: The “setFormula()” method in Calc appears to be broken. It will work for very simple formulas (e.g. “= true”) but displays an “Err:508” in the cell for even slightly more complex formulas ( e.g. “=and(a1,b1)” ). The problem occurs in both Linux and Windows environments. Steps to reproduce: 1. In LibreOffice, open Tools --> Macros --> Organize Macros --> pick any module to edit 2. Type (or cut/paste) the following program in to the empty “Sub” of your choice (Main will do) Dim oDoc 'new Calc doc for this test Dim oSheet 'points to first sheet oDoc = StarDesktop.loadComponentFromURL( "private:factory/scalc", "_blank", 0, Array() ) oSheet = oDoc.getSheets().getByIndex(0) oSheet.getCellByPosition(0, 0).setFormula("= true") 'Works oSheet.getCellByPosition(1, 0).setFormula("= true") 'Works oSheet.getCellByPosition(2, 0).setFormula("= and(a1,b1)") 'Err:508 3. Run this Macro Current behavior: Cell C3 displays “Err:508” Expected behavior: Cell C3 should display “TRUE” Operating System: All Version: 4.2.3.3 release Answers to questions: I can not personally confirm whether this is regression or a new problem. I strongly believe that this is regression since I was following code examples in documentation that appear to have worked for some people at some point. I am new to LibreOffice starting with version 4.2.3.3. One additional note. I would suggest that this is far from a simple bug. It has far broader scope, is more extensive, and creates far more damage in code than the simple exmaple that I have provided above would indicate. Even more so the case before it was narrowed down and cornered as described in the document. I have updated the document to include the simple bug report / description at the front along with a button that will run through the rest of the test cases. I will upload this as well. Sorry for the confusion that my original report may have caused, I am new to LibreOffice and its bug reporting process. My intent was to help the developers identify the complete problem quickly and provide help in narrowing down the source. Please let me know if you need additional information.
Created attachment 99423 [details] Updatd with overview and single button to run remaining test cases
I confirm that I faced with the same problem in Libreoffice 4.2.4.2 Build ID: 420m0(Build:2) I try to set a formula with the following line; oCell.SetFormula("=HYPERLINK(sheet1.A1,""Sheet1"")") than, the result is Err:508 But if I edit the formula with spreadsheet formula bar without any changes (just add a space character and delete it again and press enter) than, the formula is working good without any error messages
Hello Ewald, I change coma into formula with semicolon and it seems that works. LO 4.2.7.0.0+ Build ID: 92216be6ce13990b8ea6b6264c656d2bc1746401 TinderBox: Win-x86@42, Branch:libreoffice-4-2, Time: 2014-07-14_16:21:42 Windows 7 Home Premium. Can you try it too? Jacques
I tried FormulaLocal property instead of SetFormula method and it is working now.
Set to NEEDINFO because of comment 5. Ewald: change to RESOLVED WORKSFORME, if it's ok for you.
*** Bug 82610 has been marked as a duplicate of this bug. ***
Set the Status to WORKSFORME. Jacques
Setting back to NEW because SetFormula() and Formula property should work. expected: setFormula should work for the functions from the 'built-in' Analysis Add-In the same way the native calc functions work. actual: calc 'built-in' Analysis Add-In functions placed on sheet in Basic with oCall.setFormula(<str>) require modification in calc ui in order to compile and work correctly. So far, setFormula has failed for *every* Analysis AddIn function I have tried (see dup Bug#82610). Additionally, localization or special syntax may be required to get some calc functions to work in setFormula (even native funcs? -- h/t Jacques Guilleron). ----- It is tempting to go with resolved+workaround because oCell.FormulaLocal = "dec2hex(A1)" does work. However, I'm not sure FormulaLocal is in the published API (maybe I just didn't find it). Besides, setFormula(<fstr>) and Formula = <fstr> should simply work without the user needing to edit the cell in calc. Additionally, want to make sure can access other functions that should(?) be available in calc: e.g. Basic library.module.functions that are both placed on sheet and called from sheet through the scripting interface. ----- Thanks Kaya for the workaround (use FormulaLocal) and thanks to Ewald for the multi-page initial report, and again, a tip of the hat to Jacques Guilleron.
** Please read this message in its entirety before responding ** To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present on a currently supported version of LibreOffice (5.0.5 or 5.1.2 https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the version of LibreOffice and your operating system, and any changes you see in the bug behavior If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a short comment that includes your version of LibreOffice and Operating System Please DO NOT - Update the version field - Reply via email (please reply directly on the bug tracker) - Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) http://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to "inherited from OOo"; 4b. If the bug was not present in 3.3 - add "regression" to keyword Feel free to come ask questions or to say hello in our QA chat: http://webchat.freenode.net/?channels=libreoffice-qa Thank you for your help! -- The LibreOffice QA Team This NEW Message was generated on: 2016-04-16
** Please read this message in its entirety before responding ** To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present on a currently supported version of LibreOffice (5.2.7 or 5.3.3 https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the version of LibreOffice and your operating system, and any changes you see in the bug behavior If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a short comment that includes your version of LibreOffice and Operating System Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) http://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to "inherited from OOo"; 4b. If the bug was not present in 3.3 - add "regression" to keyword Feel free to come ask questions or to say hello in our QA chat: http://webchat.freenode.net/?channels=libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug-20170522
Reproducable in LibreOfficeDev 6.1.0.0.alpha1
There is a solution here for this. But still has buggy behavior. Although my seperator is , in my settings ; seperator works for me. https://ask.libreoffice.org/en/question/64864/result-of-setformula-not-recognised-solved/
i think this can be closed as wfm, (or notabug?) when changing the ',' in the formulas to ';' - what is needed for my german locale - all tests hold, if have to obey my locale settings as well when entering formulas manually, i'm in doubt if it's possible to write an 'universal formula interpreter' guessing correct function of separators without knowledge or respecting settings done somewhere, #82610 fails with me, and there may be many more bugs, this one is taking time from testers while they check the original complaint, find 'ah, locale settings', and then are led to other failures, other failures should have their own bugs, if anybody with ',' as formula separator has problems with oCell.setFormula("= and(c2,e2)") feel free to reopen, reg. b. ver. tested: Version: 6.2.8.2 (x64) Build ID: f82ddfca21ebc1e222a662a32b25c0c9d20169ee CPU threads: 8; OS: Windows 6.1; UI render: default; VCL: win; Locale: de-DE (de_DE); UI-Language: en-US Calc: threaded
(In reply to Ewald Anderl from comment #0) > The “setFormula()” method in Calc appears to be broken. > It ... displays an “Err:508” in the cell for > even slightly more complex formulas ( e.g. “=and(c2,e2)” ). (In reply to Kaya Uluer from comment #4) > I confirm that ... > oCell.SetFormula("=HYPERLINK(sheet1.A1,""Sheet1"")") This is not a bug. All formulas that fail in the examples are invalid for setFormula, which only takes canonical formula representation - among other things, usung semicolon as argument separator. The formulas here use comma to separate arguments, likely using "wysiwyg" approach in en-US locale (which *displays* formulas using commas). There is a FormulaLocal property
(In reply to Mike Kaganski from comment #16) > There is a FormulaLocal property ... that is intended for cases when formulas must be set or obtained using current locale conventions - e.g., from user input. In all other cases, programmers should use setFormula with canonical syntax, to not depend on user settings.