web stats
Database Writer Syntax - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 07-23-2010, 12:04 PM
iIntegrate iIntegrate is offline
Mirth Newb
 
Join Date: Jun 2010
Posts: 6
iIntegrate is on a distinguished road
Question Database Writer Syntax

I'm using a File Reader --> Database Writer channel (to Postgres).

It works when I use a hard-coded value like this:

var result = dbConn.executeUpdate("INSERT INTO patient (medicalrecordnumber) VALUES ('12345')");

As expected, it places the value 12345 in the db.

It does NOT work when I do the following:

var result = dbConn.executeUpdate("INSERT INTO patient (medicalrecordnumber) VALUES ($('MedicalRecordNumber'))");

I simply drug over the $('MedicalRecordNumber') from the "Destination Mappings" column on the right side of the screen, after having mapped it in the transformer.

I've tried several different tweaks to the syntax.

Anyone able to offer insight?

Thanks!

- Rod
__________________
Rod Sellers
"Psalm 34:3"
Reply With Quote
  #2  
Old 07-23-2010, 12:38 PM
bradd bradd is offline
Mirth Employee
 
Join Date: May 2009
Location: Irvine, CA
Posts: 133
bradd is on a distinguished road
Default

have you tried

var result = dbConn.executeUpdate("INSERT INTO patient (medicalrecordnumber) VALUES (" + $('MedicalRecordNumber') + ")");

you may also need to include \' around the value
Reply With Quote
Reply

Tags
database writer, postgres, syntax

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:47 PM.


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