Trying to filter the following scripted field Status column to show me only GOOD
When I enter a filter for this field, I get shard failures
A sample error seems to indicates that my script does not return a value in some of the exit conditions
But when I examine my script, there is a return statement for all paths
def good = new ArrayList();
def common_error_warning = new ArrayList();
def out = new ArrayList();
if(params._source.vehicle.sensors != null && params._source.vehicle.sensors.size() > 0) {
for(int i = 0; i<params._source.vehicle.sensors.size(); i++ )
{
def go = params._source.vehicle.sensors[i];
if(go.status.summary == 'Good'){
if(good.contains(go.status.short_desc)){
good.set(0, go.status.short_desc);
}else {
good.add(go.status.short_desc);
}
}
else if(go.status.summary == 'Error'){
if(common_error_warning.contains(go.status.short_desc)){
common_error_warning.set(0, go.status.short_desc);
}else {
common_error_warning.add(go.status.short_desc);
}
}
else if(go.status.summary == 'Warning'){
if(common_error_warning.contains(go.status.short_desc)){
common_error_warning.set(0, go.status.short_desc);
}else {
common_error_warning.add(go.status.short_desc);
}
}else {
out.add( go.status.short_desc );
}
}
if( common_error_warning.size() > 0 ) {
return common_error_warning.toArray();
}
else if(good.size() > 0 && common_error_warning.size() == 0)
{
return good.toArray();
}else
{
return out.toArray();
}
}
return out.toArray();
and the error point seems to be outside of my script
Can anyone illuminate?
Thank you