How to build scripted breakdown mapping for field that holds a string of sys id's with comma separated

Gal1
Kilo Guru

Hi All, 

I'm having an indicator on the metric_instance table. this metric holds in the 'field value' field two sys_id's separated by comma (string field).
And I have an indicator that has two breakdowns one is on the users the other is on the groups. 
Each one of the breakdowns has his own scripted breakdown mapping.
When I executing a job on this indicator I'm having this error : 


'
Error during JavaScript evaluation com.snc.pa.dc.ScriptException: JavaScript evaluation returned: Undefined in script: var getEngineerSysId = function(){
var str = current.field_value.getDisplayValue();
var arr = str.split(",");
return arr[1].toString();

};


at com.snc.pa.dc.Script.handleException(Script.java:215)
at com.snc.pa.dc.Script.evaluate(Script.java:176)
at com.snc.pa.dc.Script.evaluate(Script.java:156)
at com.snc.pa.dc.DataCollector.collect(DataCollector.java:385)
at com.snc.pa.dc.DataCollector.collect(DataCollector.java:313)
at com.snc.pa.dc.DataCollector.collect(DataCollector.java:247)

 


what am i doing wrong ? 

Thanks



The metric table:
find_real_file.png

 

 

Breakdown mapping script:

find_real_file.png

11 REPLIES 11

Alok Das
Tera Guru

Hi,

Could you please give a try with below code

getEngineerSysId: function(){
var str = current.field_value;
var arr = str.split(",");
return arr[1].toString();

},

Kindly mark my answer as Correct and helpful based on the Impact.

Regards,

Alok

Hi Alok, 

I tried this before and I get the same error : 

'
 
Error during JavaScript evaluation com.snc.pa.dc.ScriptException: JavaScript evaluation returned: Undefined in script: var getEngineerSysId = function(){
var str = current.field_value;
var arr = str.split(",");
return arr[1].toString();

};

'

Thanks for the update, could you please share some more details? What is your actual requirement, what you did till now(all the scripts and configuration) and where is the issue coming up?

My requirement is to measure the the time from incident creation to resolving, without monitor time - if exist - thats why im using a metric. 
I should have 2 breakdowns - groups and users.
The metric table has only one field from type string that can holds sysId - thats why im putting over there the two sysIds.