Calculate total count of sys_ids from a variable

Rooma1
Tera Contributor

Hi All,

 

I want to calculate the count of sys_ids which is getting returned but i am unable to do so as my script is not working. Can soemone please help me to rectify my script. Below the snippet from the script and logs.

 

Rooma1_0-1709971479087.png

 

Rooma1_0-1709972604368.png

 

 

8 REPLIES 8

Danish Bhairag2
Tera Sage
Tera Sage

Hi @Rooma1 ,

 

Remove the .split() function n just use .length.

 

That will give u the correct output. As the variable is already an array so u don't need to split by comma in order to get the length. Directly use .length

 

Thanks,

Danish

@Danish Bhairag2 Thanks for the suggestion. I used .length but it is calculating only one sys_id but it should count 4.

 

Rooma1_0-1709972888846.png

 

Hi @Rooma1 ,

 

Could u please try arrayvariable[0] in logs n tell me wht value u getting?// use ur variable name in place of array variable.

 

Thanks,

Danish

@Danish Bhairag2 ,

 

Getting the comma separated sys_ids. Screenshot below

 

Rooma1_0-1709973819407.png