Pass values to IN operator in a Worklight SQL adap

2019-08-28 16:29发布

问题:

I have started to work with SQL adapters in Worklight, but I do not understand how can I pass values to an IN condition when invoking my adapter procedure.

回答1:

You will need to edit your question with your adapter's XML as well as implementation JavaScript... Also, make sure to read the SQL adapters training module.


What you need to do is have your function get the values:

function myFunction (value1, value2) { ... }

And your SQL query will use them, like so (just as an example how to pass variables to any SQL query, doesn't matter if it contains an IN condition or not):

SELECT * FROM person where name='$[value1]' or id=$[value2];

Note the quotation marks for value1 (for text) and lack of for value2 (for numbers).