I try to query in my script my database. The query’s parameters depends on what I have defined in my GUI. Sometimes I like to use the NAME in query and sometimes the CITY. Here is the code:
var query = 'STRUCTTYPE: PERSON';
if (value1 != 0) {
query = query + ', NAME: ' + value1;
}
if (value2 != 0) {
query = query + ', CITY: ' + value2;
}
So the string ‘query’ itself is ok, but when I try to use it in db.query I get error message.
var results = db.query(query);
Any suggestions? Or other ways to handle this problem? Thanks!
The
queryparameter you pass toScriptDb.queryfunction must be anobject, not astring. Try this: