Issue with Split method

naveenbanda
Kilo Contributor

I created a scripted rest api where I'm receiving sys ID's as query parameter

 

var sysID=request.queryParams.sysIDS.split(',');-- if I capturing like this , in logs I could see sysID and typeOf(sysID) is undefined. 
 
If I removed split then it's fine and returning the values.
 
Sys ID which I'm passing : 46edaa6aa9fe198101b9d14ced16619f,46f09e75a9fe198100f4ffd8d366d17b
 
9 REPLIES 9

Bhavya11
Kilo Patron

Hi @naveenbanda ,

i have encounter similar issue, when i try to fetch the typeOf(request.queryParams.sysIDS) returned object for me.so .split(',') method didn't work that's  i have change that string then split the value like

var changeId = (request.queryParams.change_id || '') + '';
var sysIDChange = changeId ? changeId.split(',') : [];
 
 
then it worked fine for me. can you try similar way.
If this information proves useful, kindly mark it as helpful or accepted solution.

Thanks,
BK

Thanks Bhavya 

its worked

Hi @naveenbanda .

 

Could you please accept solution and close the thread.

 

 

If this information proves useful, kindly mark it as helpful or accepted solution.

Thanks,
BK

Anurag Tripathi
Mega Patron

Try this

 

var sysID=request.queryParams.sysIDS.toString().split(',');

-Anurag