After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 323550 - CHOOSE can return a ref, and does iteration for array indicies
CHOOSE can return a ref, and does iteration for array indicies
Status: RESOLVED OBSOLETE
Product: Gnumeric
Classification: Applications
Component: Analytics
git master
Other All
: High major
: ---
Assigned To: Morten Welinder
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2005-12-08 13:36 UTC by Nick Lamb
Modified: 2018-05-22 13:13 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Nick Lamb 2005-12-08 13:36:47 UTC
http://www.ecs.soton.ac.uk/~njl98r/excel/choose.xls

Worked in 1.4.x but now CHOOSE() function won't load from Excel XLS.

(gnumeric:20547): gnumeric:read_expr-WARNING **: EXCEL : Unhandled PTG 0x0.
formula data : (NOT shared)
       0 | 1e  2  0 19  4  4  0  a  0 14  0 1e  0 28  0 37 | .............(.7
      10 |  0 17  3  0 31 73 74 19  8 26  0 17  3  0 32 6e | ....1st..&....2n
      20 | 64 19  8 1c  0 17  3  0 33 72 64 19  8 12  0 17 | d.......3rd.....
      30 |  8  0 46 69 6e 69 73 68 65 64 19  8  3  0 42  5 | ..Finished....B.
      40 | 64  0 XX XX XX XX XX XX XX XX XX XX XX XX XX XX | d.**************

(gnumeric:20547): gnumeric:read_expr-WARNING **: CHOOSE!B5 : Unknown Formula/Array

The above is repeated more or less for all uses of CHOOSE in this test sheet.
Comment 1 Morten Welinder 2005-12-08 17:04:27 UTC
Confirmed.  (Note, that CHOOSE is a sheet name in the above error message.)

My 1.4.3 does not load this without problems, though:

CHOOSE!G13 : Hmm, ptgAttr of type 0 ??
I've seen a case where an instance of this with flag A and another with flag 3
bracket a 1x1 array formula.  please send us this file.
Flags = 0x15
CHOOSE!G13 : Hmm, ptgAttr of type 0 ??
I've seen a case where an instance of this with flag A and another with flag 3
bracket a 1x1 array formula.  please send us this file.
Flags = 0xC
CHOOSE!G13 : Hmm, ptgAttr of type 0 ??
I've seen a case where an instance of this with flag A and another with flag 3
bracket a 1x1 array formula.  please send us this file.
Flags = 0x3
Comment 2 Jon Kåre Hellan 2006-10-18 17:07:44 UTC
No warnings now, but after F9, we see #REF in B6. The formula is
=sum(A3:choose(3,B3,D3,F3))
Comment 3 Jody Goldberg 2006-10-26 12:38:01 UTC
I doubt this ever worked.  The warnings were not important and I disabled them in the development tree.  The real problem which jon_kare just pointed out is that our function interpreter is naive.  We bind references too early.

FOO(A1) is evaluated by getting the content of A1 and passing it to FOO rather than passing the reference A1 to FOO and having it decide whether it wants the content or the reference.  This will require significant core rework to support properly.

The 2nd part of the bug is actually fairly simple.  Choose is a unique combination of vararg, and array iteration.  It will need to specially handle the case where the index is a matrix.
Comment 4 Morten Welinder 2010-05-05 15:55:47 UTC
The patch over in bug 613273 is a partial solution to this.  With that,
it is possible to get a reference from evaluating A1.
Comment 5 GNOME Infrastructure Team 2018-05-22 13:13:13 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnumeric/issues/46.