Apache OpenOffice (AOO) Bugzilla – Issue 58008
Logical function from OOo Basic returns text in Calc
Last modified: 2013-08-07 15:12:27 UTC
Windows XP Czech, OOo 2.0 Czech I have module with OOo Basic function as follows: Function MyFalse() as Boolean MyFalse = False End Function Formula in the spreadsheet cell B3 is "=MYFALSE()". The result of the function does not behave as boolean. Function =CELL("TYPE"; B3) returns "l" instead of "v".
Created attachment 31551 [details] Boolean function MyFalse from OOo Basic returns text value in Calc
Confirmed on Windows XP SP2 and OpenOffice.org 2.0.1.
Hi Joerg, please have a look at this one. Frank
Hi jspitz, please have a look at the OpenOffice.org Help for the CELL function. The CELL function retrieves information about the cell and its content but does not evaluate any functions or statements. Thus CELL( "TYPE", B3 ) where B3 contains a function will return "l" which is correct. Setting invalid.
close
Hi jsk, OK, but I still cannot work with the result of the function as with the logical value (e.g. use it in "OR" or "AND" functions). It behaves as a string. Is that really correct? Jiri
Hi Jiri, i'm not an expert for calc. You should ask this question on one of the OOo mailinglists. Make sure your expression in B3 (=MYFALSE()) evaluates to something useful (probably "false") in the cell itself. Then you should be able to work with the value e.g. "=if( B3; 0; 2)" should give you "2" However, i will forward this issue to a colleague but he'll only reply on a best effort basis, but most likely he will just close the issue.
Hi, thats a problem: =if( B3; 0; 2) returns Error:501. I must use it: =if( B3 <> "False"; 0; 2), than it works. Of course, there is an easy workaround, but I still suppose to be a bug. Regards, Jiri
Hi, BASIC and it's declarations are a kind of vehicle for Calc. For now only numeric or Strings are accepted as returning values. Therefore this is a feature request and I re-assign it to the requirements team for further investigation. So the feature request is that Calc should accept the value types of boolean and others natively. The solution to your problem is just set the function result to '0' as a value of zero in a boolean formatted cell will show up as FALSE. All other numeric values will show as TRUE. Frank
*** Issue 72046 has been marked as a duplicate of this issue. ***
*** Issue 76631 has been marked as a duplicate of this issue. ***