Announcement

Collapse
No announcement yet.

Database Writer Syntax

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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 IGNORE 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 IGNORE 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"

  • #2
    have you tried

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

    you may also need to include \' around the value

    Comment

    Working...
    X