<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: how to call a query service from javascript service passing json object in ThingWorx Developers</title>
    <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/how-to-call-a-query-service-from-javascript-service-passing-json/m-p/505804#M3916</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4f; font-family: 'Century Gothic', CenturyGothic, AppleGothic, sans-serif; font-size: 12px;"&gt;Your SQL Servrice queryUser, should have two input parameters name and password&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4f; font-family: 'Century Gothic', CenturyGothic, AppleGothic, sans-serif; font-size: 12px;"&gt;select * from DPD_USERS where NAME='&amp;lt;&amp;lt;name&amp;gt;&amp;gt;' and password='&amp;lt;&amp;lt;password&amp;gt;&amp;gt;'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4f; font-family: 'Century Gothic', CenturyGothic, AppleGothic, sans-serif; font-size: 12px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Nov 2017 14:58:12 GMT</pubDate>
    <dc:creator>CarlesColl</dc:creator>
    <dc:date>2017-11-24T14:58:12Z</dc:date>
    <item>
      <title>how to call a query service from javascript service passing json object</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/how-to-call-a-query-service-from-javascript-service-passing-json/m-p/505803#M3915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a requirement where in I am calling a javascript service from a mashup, this service will inturn call a sql query service passing the json parameter. Once the sql service is executed, result of the query execution is retrieved in the javascript service.&lt;/P&gt;&lt;P&gt;Below are my services&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;Javascript service&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var params = {&lt;/P&gt;&lt;P&gt;username: username /* STRING */,&lt;/P&gt;&lt;P&gt;password: password /* STRING */&lt;/P&gt;&lt;P&gt;};&lt;/P&gt;&lt;P&gt;logger.warn("username in params = " +params.username);&lt;/P&gt;&lt;P&gt;logger.warn("password in params = " +params.password);&lt;/P&gt;&lt;P&gt;var queryparams = {};&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;queryparams['name'] = params.username;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;queryparams['password'] = params.password;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;// result: INFOTABLE dataShape: "undefined"&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;var result = me.queryUser(queryparams);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;SQL Query service&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from DPD_USERS where NAME=[[params.name]] and password=[[params.password]] //where params is the json parameter sent in from JS service&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I execute the JS service its gets data properly and tries to execute the query service. However, in query service execution, I get the following error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #b94a48; font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; background-color: #f2dede;"&gt;Wrapped org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "SELECT * FROM &amp;lt;MY_TABLE&amp;gt; WHERE NAME=[&lt;LI&gt;[PARAMS['name']]] AND PASSWORD=[[PARAMS['password']]] "; expected "ALL, ANY, SOME, SELECT, FROM, WITH"; SQL statement: select * from &lt;SPAN style="color: #b94a48; font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; background-color: #f2dede;"&gt;&amp;lt;MY_TABLE&amp;gt;&lt;/SPAN&gt; where NAME=[[params['name']]] and password=[[params['password']]] [42001-192] Cause: Syntax error in SQL statement "SELECT * FROM &lt;SPAN style="color: #b94a48; font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; background-color: #f2dede;"&gt;&amp;lt;MY_TABLE&amp;gt;&lt;/SPAN&gt; WHERE NAME=[&lt;/LI&gt;&lt;LI&gt;[PARAMS['name']]] AND PASSWORD=[[PARAMS['password']]] "; expected "ALL, ANY, SOME, SELECT, FROM, WITH"; SQL statement: select * from &lt;SPAN style="color: #b94a48; font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; background-color: #f2dede;"&gt;&amp;lt;MY_TABLE&amp;gt;&lt;/SPAN&gt; where NAME=[[params['name']]] and password=[[params['password']]] [42001-192]&lt;/LI&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe I am making a mistake in extracting parameters from json object. I could not get find any post which could lead me to correct syntax. Please help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Pawan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Nov 2017 14:45:20 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/how-to-call-a-query-service-from-javascript-service-passing-json/m-p/505803#M3915</guid>
      <dc:creator>pbadiger</dc:creator>
      <dc:date>2017-11-24T14:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: how to call a query service from javascript service passing json object</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/how-to-call-a-query-service-from-javascript-service-passing-json/m-p/505804#M3916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4f; font-family: 'Century Gothic', CenturyGothic, AppleGothic, sans-serif; font-size: 12px;"&gt;Your SQL Servrice queryUser, should have two input parameters name and password&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4f; font-family: 'Century Gothic', CenturyGothic, AppleGothic, sans-serif; font-size: 12px;"&gt;select * from DPD_USERS where NAME='&amp;lt;&amp;lt;name&amp;gt;&amp;gt;' and password='&amp;lt;&amp;lt;password&amp;gt;&amp;gt;'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4f; font-family: 'Century Gothic', CenturyGothic, AppleGothic, sans-serif; font-size: 12px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Nov 2017 14:58:12 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/how-to-call-a-query-service-from-javascript-service-passing-json/m-p/505804#M3916</guid>
      <dc:creator>CarlesColl</dc:creator>
      <dc:date>2017-11-24T14:58:12Z</dc:date>
    </item>
  </channel>
</rss>

