That looks pretty easy. I was looking at http://poi.apache.org/spreadsheet/index.html which looks like it can do 2007/2010 xml formats but I never figured out how to use it with Mirth. I need to be able to write Excel files.
I think it would be really nice if we could make that a file connector but I don't know enough about programming to be able to do that and give to the community.

Comment

Having Excel as a file destination is definitely possible with this module. I had a small proof of concept somewhere, but I can't find it at the moment. Basically you'd just loop through each row and column of the message writing each data element to the coordinating cell in Excel.

Comment

Please bear with me - I'm a Mirth newbie.
What kind of data would you enter in your inbound Excel message template?
I'm interested in running some bench tests using sample patient data - lab results, notes, etc. but have no good data source to pass through Mirth.
Thx,
Lou

Comment

The javascript is written to be generic. You can provide it with any Excel (.xls only) file and it will read in all the data on the first worksheet.

You shouldn't put any data in the inbound message template. It is simply the template used for the transformer in your destinations. You will put a <coln></coln> tag for each column used in your Excel report. Because this is read in as an array it's zero-based, so you start counting at zero. (E.g., column one is <col0></col0>, column two is <col1></col1>, etc.)

I can tell you that the Java library is a little memory/processor intensive. I was hitting 250MB memory used and 50% processor used while it was processing. I would say it took about five minutes or so to read my 319KB Excel file with about 500 rows.

Comment

I've tried to follow your instructions, but when I try to use the Channel I reveiced an error saying:

Code:

[2011-07-08 09:55:32,817]
FATAL (org.mule.impl.DefaultComponentExceptionStrategy:84): The error is: null
java.lang.NullPointerException
at com.webreach.mirth.connectors.js.JavaScriptMessageReceiver.poll(JavaScriptMessageReceiver.java:88)
at org.mule.providers.PollingMessageReceiver.run(PollingMessageReceiver.java:90)
at org.mule.impl.work.WorkerContext.run(WorkerContext.java:290)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Unknown Source)
[2011-07-08 09:54:52,754]
FATAL
(org.mule.impl.DefaultComponentExceptionStrategy:83): The Default Component Exception Strategy has been invoked but there is no current event on the context
[2011-07-08 09:51:07,408]
ERROR
(com.webreach.mirth.connectors.js.JavaScriptMessageReceiver:152): org.mozilla.javascript.EcmaError: TypeError: Cannot call property getWorkbook in object [JavaPackage jxl.Workbook]. It is not a function, it is "object". (62c52ab0-7111-48f0-bafc-db7bccfbb578#9)

Comment

I've tried to follow your instructions, but when I try to use the Channel I reveiced an error saying:

Code:

[2011-07-08 09:55:32,817]
FATAL (org.mule.impl.DefaultComponentExceptionStrategy:84): The error is: null
java.lang.NullPointerException
at com.webreach.mirth.connectors.js.JavaScriptMessageReceiver.poll(JavaScriptMessageReceiver.java:88)
at org.mule.providers.PollingMessageReceiver.run(PollingMessageReceiver.java:90)
at org.mule.impl.work.WorkerContext.run(WorkerContext.java:290)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Unknown Source)
[2011-07-08 09:54:52,754]
FATAL
(org.mule.impl.DefaultComponentExceptionStrategy:83): The Default Component Exception Strategy has been invoked but there is no current event on the context
[2011-07-08 09:51:07,408]
ERROR
(com.webreach.mirth.connectors.js.JavaScriptMessageReceiver:152): org.mozilla.javascript.EcmaError: TypeError: Cannot call property getWorkbook in object [JavaPackage jxl.Workbook]. It is not a function, it is "object". (62c52ab0-7111-48f0-bafc-db7bccfbb578#9)

Any hints for me?

Thanks, Regards,
- Bernd

Unfortunately Mirth errors are rather cryptic. The "function not an object" error is something I've seen from time to time working with JAVA classes from within Mirth. It usually either means the JAVA class isn't loaded (Mirth hasn't been restarted since the .jar file was installed) or that the method isn't being used correctly.

You could try instantiating the object before using it. Something like:

I also just realized that I left out the part in the code where I import the JAVA package. I believe the following is what I do in my channel. (I have another client Mirth setup installed at the moment, so I can't verify.)

Comment

This works great, the only thing is dat it keeps looping through the excel file because the source connector is polling every 5 secs. What I want is to stop processing the excel file once it reached the last row. Any ideas?

We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, personalize advertising, and to analyze site activity. We may share certain information about our users with our advertising and analytics partners. For additional details, refer to our Privacy Policy.

By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.