Issue 58008 - Logical function from OOo Basic returns text in Calc
Summary: Logical function from OOo Basic returns text in Calc
Status: CONFIRMED
Alias: None
Product: Calc
Classification: Application
Component: code (show other issues)
Version: OOo 2.0
Hardware: All All
: P3 Trivial with 1 vote (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
: 72046 76631 (view as issue list)
Depends on:
Blocks:
 
Reported: 2005-11-16 14:18 UTC by jspitz
Modified: 2013-08-07 15:12 UTC (History)
3 users (show)

See Also:
Issue Type: FEATURE
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Boolean function MyFalse from OOo Basic returns text value in Calc (7.75 KB, application/vnd.sun.xml.calc)
2005-11-16 14:21 UTC, jspitz
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description jspitz 2005-11-16 14:18:57 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".
Comment 1 jspitz 2005-11-16 14:21:14 UTC
Created attachment 31551 [details]
Boolean function MyFalse from OOo Basic returns text value in Calc
Comment 2 martinkozak 2006-02-06 14:16:17 UTC
Confirmed on Windows XP SP2 and OpenOffice.org 2.0.1.
Comment 3 frank 2006-02-07 13:20:09 UTC
Hi Joerg,

please have a look at this one.

Frank
Comment 4 joerg.skottke 2006-03-31 06:31:34 UTC
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.
Comment 5 joerg.skottke 2006-03-31 06:32:04 UTC
close
Comment 6 jspitz 2006-03-31 07:30:41 UTC
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
Comment 7 joerg.skottke 2006-03-31 08:18:15 UTC
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.
Comment 8 jspitz 2006-03-31 08:31:39 UTC
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
Comment 9 frank 2006-04-07 11:14:25 UTC
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
Comment 10 niklas.nebel 2007-01-15 11:33:15 UTC
*** Issue 72046 has been marked as a duplicate of this issue. ***
Comment 11 gercokees 2007-04-27 15:29:08 UTC
*** Issue 76631 has been marked as a duplicate of this issue. ***