web stats
How can I cancel the file writer when no data is returned? - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 12-09-2015, 05:31 AM
GaryK GaryK is offline
What's HL7?
Join Date: Dec 2015
Posts: 1
GaryK is on a distinguished road
Default How can I cancel the file writer when no data is returned?

I am using a Mirth Channel to read data in from sql server and then output the data as CSV file into specific folder using a destination and a transformer.

Destination sets the output folder and file name and the transformer is a javascript that fetches the data from SQL server and formats the data.

How can I cancel the file writer when no data is returned?

var dbConn = databaseConnectionFactory.createDatabaseConnection('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sqlserver://<IPaddress>:1433/<DB>','<user>',<password>');

var result1 = dbConn.executeCachedQuery("exec [z_stored_proc] 'Parameter1'");
   tmp.row += <row>
Using Mirth Connect Server
Gary K
Reply With Quote
Old 12-09-2015, 07:57 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road

Well, you could move some of that logic into the filter. That way you can just return false if you find no results. The executeCachedQuery method returns a CachedRowSet, so you can just call size() on it and verify it's greater than zero. Then to pass it on to the transformer, you could put it in the connector/channel map, or you could just declare it as a global scope variable by removing the "var " in front of the declaration.
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.

- How do I foo?
- You just bar.
Reply With Quote

file writer

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 07:35 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation