Setting a custom variable in TSVB bucket script

Hello,

Is it possible to set a variable inside a bucket script in tsvb? i would like to compare two values and set the new variable to be the value that exists.

right now I have:

my code

if (params.inmin != null) {
   params.in= params.inmin;
} else if (params.inhour != null) {
   params.in=params.inhour;
}

if (params.outmin != null) {
    params.out= params.outmin;
} else if (params.outhour != null) {
   params.out=params.outhour;
} 

if (params.in > 0.50) {
    params.solved=1;
} else if (params.out > 0.50) {
  params.solved=1;
} else { 
   if (params.in > params.out) {
     params.solved=params.in;
   } else if (params.out > params.in) {
     params.solved=params.out;
    }
}

return params.solved;

which results in:


but i would expect to see the line go all the way across the graph.

any help with this would be great!

Thank you

Seems the issue might start from when i check to see if the fields exist with :

if (params.inmin != null) {
   params.in= params.inmin;
} else if (params.inhour != null) {
   params.in=params.inhour;
}

if (params.outmin != null) {
    params.out= params.outmin;
} else if (params.outhour != null) {
   params.out=params.outhour;
} 

is there a better way to check if the field exists?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.