web stats
Example needed - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 05-09-2018, 08:33 AM
mroberts mroberts is offline
OBX.1 Kenobi
Join Date: Jul 2010
Posts: 40
mroberts is on a distinguished road
Default Example needed

I have been trying and reading everything I can find in the forums here on how to use javascript to query a db and return a string value from a select query. Everything I try ends up giving me a com.mirth.connect.server.userutil.MirthCachedRowSe t@2e19d518

I can make the connection string to the db no problem

Lets use this example

table in db called person

Query I am trying to run "select last_name from person where person_nbr = 350"

I need to get this string out and I always end up with a cachedrowset

I am doing this in a transformer to get the value and put it in a channel map.
Reply With Quote
Old 05-10-2018, 01:34 AM
amble amble is offline
OBX.2 Kenobi
Join Date: Nov 2015
Posts: 95
amble is on a distinguished road

We use parameterised lists but something like this you should be able to work from?

PHP Code:
sqlQuery  "SELECT top 1 * "
sqlQuery += "from table1 "
sqlQuery += "where value = ?"

while (count maxTries)
// initalise sql statement for result here

if (result.next() == false
tmp['VALUE'] = "NotFound";
            else    do
tmp['VALUE'] = result.getString(1);
Reply With Quote

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 11:22 AM.

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