[Libreoffice-bugs] [Bug 130583] switch() gives "wrong data type" error on reordering value-result pairs

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Wed Feb 12 12:13:29 UTC 2020


https://bugs.documentfoundation.org/show_bug.cgi?id=130583

--- Comment #4 from milan.berta at gmail.com ---
OK, correct. Putting D3&"" for the expression works, independently on the
format of the valueN "1" or 1, "2" or 2.

Strikes me that 
=SWITCH(D3;"1*";"a";1;"b";2;"c";"3+4";"d")
won't work then. That is comparing number with number does not work. But
converting D to text numbers is OK.

Not that in the original example, the value-result pairs are only reordered:
SWITCH(A3;"1";"b";"2";"c";"1*";"a";"3+4";"d")                  
SWITCH(D3;"1*";"a";"1";"b";"2";"c";"3+4";"d")

But

SWITCH(G3;1;"a";2;"b";"3";"c";4;"d")    
code    decode
1       a
2       b
3       c
4       d
blah    #N/A

works as a charm. That is the other way around: comparing text number "3" with
number 3.

So, how should one know, in which cases valueN is going to be interpreted as a
text and in which cases as a number?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20200212/b144297a/attachment.htm>


More information about the Libreoffice-bugs mailing list