web stats
Wrong Value coming in Variable - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 08-08-2010, 01:04 PM
mroberts mroberts is offline
OBX.1 Kenobi
 
Join Date: Jul 2010
Posts: 40
mroberts is on a distinguished road
Default Wrong Value coming in Variable

I have the HL7 message passing correctly. (thanks to everyones help) I am able to extract the segments that I am looking for. I am pulling the visit and assigning it to a variable $('iris_visit_id') in a transformer. this variable is a text number looking like 875765-1

If I write it out to a file it stays the same value. when I write it to the database it comes out 87564 versus 875765-1 Any ideals?


var dbConn = DatabaseConnectionFactory.createDatabaseConnection ('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sql server://localhost:1433/mirthdb','sa','password');

var msg = new XML(channelMap.get( 'msg' ).toString());
for each (seg in msg..FT1) {
var charge_id = seg['FT1.2']['FT1.2.1'].toString();
var ft1segnum = seg['FT1.1']['FT1.1.1'].toString();
expression = "insert into iris_charges (inbound_charges,iris_charge_id,iris_visit_id,ft1_ seg_num) values(newid(),"+charge_id+","+$('iris_visit_id')+ ","+ft1segnum+")";
dbConn.executeUpdate(expression)
}

Last edited by mroberts; 08-08-2010 at 01:07 PM. Reason: forgot something
Reply With Quote
  #2  
Old 08-08-2010, 06:36 PM
mnowlin mnowlin is offline
OBX.3 Kenobi
 
Join Date: Sep 2006
Posts: 142
mnowlin is an unknown quantity at this point
Default

Well, your database is doing the 875765-1 math... You'll probably need to need to add some escaped quotes in your expression line:

Code:
expression = "insert into iris_charges (inbound_charges,iris_charge_id,iris_visit_id,ft1_ seg_num) values(newid(),"+charge_id+",\'"+$('iris_visit_id')+ "\',"+ft1segnum+")";
Reply With Quote
  #3  
Old 08-09-2010, 07:22 AM
mroberts mroberts is offline
OBX.1 Kenobi
 
Join Date: Jul 2010
Posts: 40
mroberts is on a distinguished road
Default

Let me try that. The column in the database is a varchar(20). I will test and try. Thanks for the input
Reply With Quote
Reply

Tags
variable

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 06:23 AM.


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