1.2k questions

1.4k answers

361 comments

339 users

Categories

Sidebar
0 votes
586 views
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:

by brandon-w-8204 (34.1k points)
...