Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Hello.
I'm have trouble using Query Parameters with Query Services.
in Thing, I made two Services(SQL Query Service, Local Javascript Service).
(attach the photo.)
1. SQL Query Service have a parameter that is query type. (Service Name : test)
select usr_nm, gend_cd from t_user
where [[input]]
;
2. Local Javascript Service uses first one. (Service Name : testAction)
var query = input;
// result: INFOTABLE dataShape: ""
var result = me.test({
input: query /* QUERY */
});
3. I execute second one with this parameter.
{
"filters": {
"type": "EQ",
"fieldName": "gend_cd",
"value": "M"
}
}
But I get an error. ( Error executing service testAction. Message :: org.json.JSONObject cannot be cast to java.lang.String - See Script Error Log for more details.)
I tried to change the datatype query to json in both services.
And tried to change parameter value
{
"filters": {
"type": "EQ",
"fieldName": "gend_cd",
"value": "M"
}
}
to
and gend_cd = 'M'
But couldn't solve it.
What should I do?
Thank you.
It looks like it is going through some conversion problems
1. if you directly do
var query = {
"filters": {
"type": "EQ",
"fieldName": "gend_cd",
"value": "M"
}
}
it works?
You could try:
var query = JSON.parse(input);
I tried but it didn't work.
I think I should learn more about conversion problems.
Thanks & Regards.