Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Support (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=6)
-   -   Database Writer Syntax (http://www.mirthcorp.com/community/forums/showthread.php?t=4164)

iIntegrate 07-23-2010 01:04 PM

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

bradd 07-23-2010 01:38 PM

have you tried

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

you may also need to include \' around the value


All times are GMT -8. The time now is 12:37 PM.

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