XLLoop 0.3.1 Released
April 5, 2010 15 Comments
A new version of XLLoop is now available at the sourceforge site: xlloop.sf.net.
The main changes are:
- Added round-robin connection mode for multiple servers in binary mode
- Added retry ability to binary mode
- Added annotation support for function information to reflection-based java functions
- Java server framework now requires Java 1.5 (for annotations)
- Generic function category can be customized
- Added ability to load INI keys from an external file
- Added ability to load INI keys from the registry
Advertisement
Amazing piece of software, just what I have been looking for, for quite some time. I have a large set of python routines that I would like to hook up to Excel. So far so good, but I have two questions (both Python related)
1) I have no problem using column vectors as inputs, but when I use row vectors or matrices I get an error, just using the standard .py server with no adjustments (ArgsTest). As it looks like the code should support rows/matrices, is there a tweak I can make to the xlloop.py to fix this?
2) The GetFunctions method to set-up all functions inside Excel seems like a great way to make the interface very user friendly from Excel. However, I could not find any description of the FunctionInformation array so I could not find a way to make this work from Python. Is there a description how I should construct such an array in python as a response to the GetFunctions call?
Many thanks,
Z
First issue solved. There seems to be a minor bug in the xloop.py file.
Line 60: change “a.append(a)” to a.append(aa)”
to get rows and matrices working smoothly.
Still very interested to see if we can figure out the second issue, i.e. the GetFunctions definition from Python.
I apologize if this is not the right forum, in which case I would appreciate if someone could point me in the right direction.
Hi,
Thanks for the info. I will update the script for the next release.
To get the GetFunctions working you need to pass back an array of 2 column arrays.. its a little convoluted as its stuffed in the XL_MULTI type. You need essentially:
[
[ "functionName", "MyFunction" ],
[ "functionHelp", "Provides something really useful" ],
[ "category", "My Python Functions" ],
[ "argumentText", "arg0,arg1,arg2" ],
[ "argumentHelp", [ "arg0 is great", "arg1 is better", ... ],
], [ .. ]
Only the functionName parameter is mandatory.
Hope that is clear.
Cheers,
Peter
Hi Poidasmith:
Will you be so kind helping me in getting XLLoop work from Excel?
My questions are the following:
1) When I start the reflect_example.py a message “Starting Function Server on port 5460…” is printed on the DOS command line. I don’t see this message when I start the server_example.py, is that normal?
2) After I’ve started the server_example.py how will I see/access the functions from Excel?
Thanks,
StuStd
Much appreciated. I do understand the GetFunctions onceptually, however I can not get it to work in practice. There is some very specific detail I must be missing. For example, if I insert the following into the invoke function of the TestHandler in “server-example.py”
if name == “org.boris.xlloop.GetFunctions”:
return [["functionName","test"],["category","PYTHON"],]
.. I still don´t see the function “test” inside Excel. I have tried various different combinations of arrays (different row/column combinations) but none of them work. Could you please take a look and share an exact line that works in the python demo when you run it?
If it helps, I can return the favor by writing a generic GetFunctions object/code, which might simplify this whole process for python users?
PS: There was a typo in line 135 of xlloop.py (TupleType section):
“isintance” should be “isinstance” I guess
I really appreciate your work,
Ziggy
My bad, the answer is that the outer bracket must be a tuple, like hinted in your answer. Everything works great now, with the typo in line 135 fixed and the following return statment (for example):
return ([["functionName","df"],["category","PYTHON"]],)
Great stuff!
Z
The HTTP protocol doesn’t seem to sent the “org.boris.xlloop.Initialize” function to the JSON servlet.
I’ve tried explicitly setting send.user.info=true without success either.
The “binary” protocol sends the username and computername properly in the “Initialize” function.
Any guidance is appreciated.
Hi,
Thanks for the bug report. Yes, there is an issue here. I’ll make a fix and get a release out shortly.
Regards,
Peter
First off, great tool! as a newbie….Can you point me to examples of creating a functions that take excel ranges and then loop over the the ranges in excel? not sure of how a excel ranges and variant fields map into java. thanks. -Scot
Hi,
Excel ranges are sent to your java server as XLArray objects. You can use the methods on this object to access the data – eg. get(int row, int column). Internally the data is stored in a 1D array in row-major order.
Hope that helps.
Regards,
Peter
Hi,
Is it possible to create objects in the spreadsheet with Xlloop?
E.g… ‘=FS(“MakeObject”,”FooClass”,”FooObject”,param1,param2)
Where MakeObject puts the newly created FooClass object (named FooObject) in a map, and makes it retrieveable with a key: e.g. “=FS(“GetObject”,”FooObject”)
If it is, can you write a couple of lines with an example?
Regards,
Ale
Hi,
Yes, it is quite easy to do this with XLLoop, There is a utility class in the util package in the download called ObjectRegistry. It is basically a cache for object, that returns a “handle” to that object as a string. This is used by the ReflectionFunctionHandler – if you return an Object from your method it will automatically convert this to an object handle. This handle is a string, which can be used in your spreadsheet to refer to the object on the server.
This in used in the lisp handler (included in the source in the download) – see http://xlloop.sourceforge.net/lisphandler.html – the second screenshot show a server object handle being used in the spreadsheet.
Hope that helps!
Regards,
Peter
Thanks Peter,
great piece of work!
Regards,
Ale
Hi,
I considered that XLLoop can return a object or array of strings to excel, then the add in on excel put separate attribute and value on separate cell?
Thanks
Hi,
I am trying to figure out how to return a list from Python and display the values in the list in separate Excel cells. Can anyone help with this?
Thanks!
- A