3 Replies Latest reply: Dec 2, 2010 9:28 AM by Alberto Gugel

# Adding guage results together {how??}

Hi,

I want to do the following:

Gauge 1 has a result; Gauge 2 has a result.

I want to make a third gauge which basicly does: (GAUGE1.Result + GAUGE2.Result) /2

Is this possible? Or is the only way out programming the gauges in Variables?

• ###### Adding guage results together {how??}

I think, you can just add both expression you gave in Gauge1 and Gauge2.

(Gauge1expression + Gauge2 expression)/2 will give you the answer if i am not misunderstood your question.

regards

• ###### Adding guage results together {how??}

Yes, this is true. But I do not want to store the expression's logic in more than 1 place.

That way, if I fix a bug in 1 gauge, all other gauges will also be fixed.

• ###### Adding guage results together {how??}

Hi markvandermeij, I can probably help you, even if the solution I'm suggesting you isn't that practical. You'll see.

Let say you need three expressions, one for Gauge1, one for Gauge2 and the last one to represent the average in Gauge3.

In this situation I would set three variables at the end of the script:

`SET Expr1 = "sum({\$<myField1 = {'myValue1'}>}Value)";`

`SET Expr2 = "sum({\$<myField2 = {'myValue2'}>}Value)";`

`SET AvgExp = "rangeavg(\$(Expr1),\$(Expr2))"`

or, if you prefer:

`SET AvgExpr = ((\$(Expr1))+(\$(Expr2))) / 2`

Then, you'll need to refer to these variables when defining your three gauges using again the so called dollar expansion.

Hope it's all clear.