Sidebar

Need to Update Database in Destination Node using getNode

0 votes
420 views
asked Mar 21, 2019 by gene-p-5146 (120 points)
I am trying to do the following in the Destination Node and it does not like the syntax. I have the Destination set to Database and this is what I put in my "Update Stmnt:" window. What is the proper way of doing this?

//Declare the Variables
var ApptNum = message.getNode('SCH-1');
var QueryResult = '';

//Update Appoitment to Confirmed
QueryResult = qie.doQuery(
   "gCPS DB",
   "Update a \n" +
   "Set a.Status = 'Confirmed via Text' \n" +
   "From Appointments a \n" +
   "Where a.AppointmentsId = "+ApptNum+" \n")

1 Answer

0 votes

The update statement will only include your update sql statement. QIE is doing the query for you and not running Javascript. To include data from the message or source you need to use the NodeTag. {m:NodePath}, {s:NodePath}. 

This is what your query above would look like:

Update a
Set a.Status = 'Confirmed via Text'
From Appointments a
Where a.AppointmentsId = {m:SCH-1}

Here is a screenshot of the Update Stmnt box:

answered Mar 21, 2019 by brandon-w-8204 (33,270 points)
...