Issue 78256 - LOOKUP function doesn't work in a macro
Summary: LOOKUP function doesn't work in a macro
Status: CLOSED DUPLICATE of issue 58286
Alias: None
Product: Calc
Classification: Application
Component: programming (show other issues)
Version: OOo 2.0.2
Hardware: PC Windows XP
: P3 Trivial (vote)
Target Milestone: ---
Assignee: spreadsheet
QA Contact: issues@sc
URL:
Keywords: needmoreinfo
Depends on:
Blocks:
 
Reported: 2007-06-09 12:08 UTC by hywelm
Modified: 2007-08-07 09:50 UTC (History)
1 user (show)

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


Attachments
Spreadsheet & embedded macro (14.50 KB, application/vnd.sun.xml.calc)
2007-06-30 18:04 UTC, hywelm
no flags Details
Standalone macro code (3.35 KB, text/plain)
2007-06-30 18:06 UTC, hywelm
no flags Details
fixed bugdoc (18.34 KB, application/vnd.sun.xml.calc)
2007-08-06 14:55 UTC, frank
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description hywelm 2007-06-09 12:08:16 UTC
I have a Calc spreadsheet with a macro that calls the LOOKUP function using the 
FuncService.callFunction method. This worked fine in OOo 1.1.0. However, when I 
open this spreadsheet in OOo 2.0.2 and run the macro, the LOOKUP function 
doesn't return any matching data, even though in OOo 1.1.0 it finds a match. 
Has anyone seen this kind of problem (I couldn't find any issues that sounded 
similar)?
Comment 1 paul.m.nz 2007-06-26 03:49:50 UTC
If you can attach the file and step by step instructions on how to reproduce the
problem it would help greatly.
Comment 2 hywelm 2007-06-30 18:04:28 UTC
Created attachment 46397 [details]
Spreadsheet & embedded macro
Comment 3 hywelm 2007-06-30 18:06:35 UTC
Created attachment 46398 [details]
Standalone macro code
Comment 4 hywelm 2007-06-30 18:07:08 UTC
Hopefully I've managed to attach two files:

"Donations - Debug.sxc" - the spreadsheet with the problem (I think this file 
also contains the macro code as well - hope that won't cause the file to be 
blocked)
"Update_R68.bas" - the macro code in a separate file

To show the problem in OOo 2.0.2 open the spreadsheet (enabling macros) then 
press the "Update R68" button on the "Gifts" sheet. I get an error 
stating "BASIC runtime error. Object variable not set." Opening the spreadsheet 
in OOo 1.1.0 and running the macro works fine.
Comment 5 frank 2007-08-06 14:55:06 UTC
Hi,

checked this documewnt with 1.1.5 and got the same Error message as with 2.2.1 .
So this document itself or better it's Macro code is faulty. I will attach a
document which is fixed by DR and will work. Have a look at the line with the
YEARFRAC function call to see how he made it work.

Thanks Daniel.

Frank
Comment 6 frank 2007-08-06 14:55:53 UTC
Created attachment 47335 [details]
fixed bugdoc
Comment 7 frank 2007-08-06 14:56:15 UTC
closed invalid
Comment 8 hywelm 2007-08-06 21:30:39 UTC
I tried the modified spreadsheet but this gave an incorrect result when run in 
OOo 2.0, but the correct result in OOo 1.1. The problem is with the LOOKUP 
function, not YEARFRAC. LOOKUP should find a match for all donors in the 
spreadsheet, but it doesn't. I ran in debug after placing a breakpoint at the 
modified line of code. Looking at the values 
of "donor_first_name", "donor_last_name" and "declaration_date" variables after 
hitting the breakpoint shows that none of them have been updated by the result 
of the LOOKUP functions - presumably because LOOKUP has not found any matches.
Comment 9 frank 2007-08-07 09:50:17 UTC
Hi,

so this is also a double to Issue 58286 . Your search vector is not sorted.
Please have a look at the mentioned Issue and it's duplicates and follow up's.
You may have a look at Issue 2168 for the reason of this change.

Frank

*** This issue has been marked as a duplicate of 58286 ***
Comment 10 frank 2007-08-07 09:50:37 UTC
closed double