Databases Reference
In-Depth Information
5.
Click on OK to close the Variable Overview window.
6.
Go to the Dashboard tab.
7.
Open the properties for the Load Factor % gauge by right-clicking on the
object and selecting Properties… .
8.
On the Expressions tab, replace the definition for the Load Factor %
expression with $(eLoadFactor) .
9.
On the Presentation tab, replace the expression defined in the Text in Chart
with:
=Num($(eLoadFactor), '##.#%')
10. Click on OK to close the Chart Properties dialog.
Now, when you look at the Load Factor % gauge, you will notice that visually
nothing has changed. Behind the scenes, the gauge is now referencing
the centrally managed eLoadFactor variable. If we were to change this variable
in the Variable Overview window, the change would automatically be reflected
in the gauge.
There are a few points about the steps we used that you will want to take note of:
Enclosing the expression in parentheses : As we want to make sure that
the expression always gets calculated in the right order, we enclose it
in parentheses. Imagine, for example, we had an expression vExample
containing 10 + 5 without parentheses. If we were to use that variable in an
expression containing a fraction, for example, $(vExample) / 5 , the wrong
result would be returned ( 11 instead of 3 ).
Not prefixing the variable expression with an equals sign : When the
expression in a variable definition is prefixed with an equals sign (=), the
variable gets calculated globally. In our example this would mean that the
Load Factor % value is calculated once for the entire data model. When used
in a chart, all dimensions would be ignored and the expression would just
return the same global value for each dimension. As we obviously do not
want this to happen, in this example we do not prefix our expression with an
equals sign.
Dollar Sign Expansion : Enclosing a variable (or an expression) between
a dollar sign and parentheses (Dollar Sign Expansion), as we did on the
chart's expressions, tells QlikView to interpret the contents, instead of just
displaying the contents. For example, $(=1 + 1) will not return the static
text 1 + 1 , but will return 2 . We will look at Dollar Sign Expansion in more
detail in Chapter 10 , Advanced Expressions . For now, it's sufficient to note that,
when referencing variables, we should use the Dollar Sign Expansion syntax
in order for them to be interpreted.
 
Search WWH ::




Custom Search