web stats
FT1 loop issue - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 04-02-2013, 10:16 AM
Tireseus Tireseus is offline
OBX.1 Kenobi
 
Join Date: Sep 2007
Posts: 40
Tireseus
Default FT1 loop issue

I need to query a database and replace a number in the FT1

(I am making the db connection earlier in the code.)

for(var i=0;i<msg['FT1'].length();i++)

{
ft1OldId = msg['FT1'][i]['FT1.20']['FT1.20.1'].toString();
var result = dbConn.executeCachedQuery('SELECT DoctorFacilityID FROM DoctorFacility WHERE \'' + ft1OldId + '\' = DotId');

if(result.next())
{

ft1NewId = result.getString(1);
msg['FT1'][i]['FT1.20']['FT1.20.1'] = ft1NewId;

}
}


message sends but nothing is changing. Any ideas?
Reply With Quote
  #2  
Old 04-02-2013, 10:19 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 946
cory_cole is on a distinguished road
Default

Try this for trouble shooting....


for(var i=0;i<msg['FT1'].length();i++)

{
ft1OldId = msg['FT1'][i]['FT1.20']['FT1.20.1'].toString();
var query = 'SELECT DoctorFacilityID FROM DoctorFacility WHERE \'' + ft1OldId + '\' = DotId';


logger.error(query);//Then cut and paste the query to the db.
var result = dbConn.executeCachedQuery(query);

if(result.next())
{

ft1NewId = result.getString(1);
logger.error(ft1NewId);
msg['FT1'][i]['FT1.20']['FT1.20.1'] = ft1NewId;

}
}
Reply With Quote
  #3  
Old 04-02-2013, 10:24 AM
Tireseus Tireseus is offline
OBX.1 Kenobi
 
Join Date: Sep 2007
Posts: 40
Tireseus
Default

attached is what spit out.

821 is correct. But the Encoded message did not change.
Attached Images
File Type: jpg ft1 error.JPG (31.0 KB, 6 views)
Reply With Quote
  #4  
Old 04-02-2013, 10:32 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 946
cory_cole is on a distinguished road
Default

Can you post your channel?
Reply With Quote
  #5  
Old 04-02-2013, 01:04 PM
Tireseus Tireseus is offline
OBX.1 Kenobi
 
Join Date: Sep 2007
Posts: 40
Tireseus
Default

here is channel
Attached Files
File Type: xml dasdfasdf.xml (11.7 KB, 6 views)
Reply With Quote
  #6  
Old 04-02-2013, 01:43 PM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 946
cory_cole is on a distinguished road
Default

I believe you need...

return msg;

at the end;
Reply With Quote
  #7  
Old 04-02-2013, 02:02 PM
Tireseus Tireseus is offline
OBX.1 Kenobi
 
Join Date: Sep 2007
Posts: 40
Tireseus
Default

Quote:
Originally Posted by cory_cole View Post
I believe you need...

return msg;

at the end;
That was it, thanks.
Reply With Quote
Reply

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 -7. The time now is 06:57 AM.


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