cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Error of "Query Parameter for Query Services"

EUNJY
4-Participant

Error of "Query Parameter for Query Services"

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.

2 REPLIES 2
PaiChung
22-Sapphire I
(To:EUNJY)

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);

 

EUNJY
4-Participant
(To:PaiChung)

I tried but it didn't work.
I think I should learn more about conversion problems.


Thanks & Regards.

Top Tags