Databases Reference
In-Depth Information
Using variables in set expressions
It's sometimes convenient to make use of variables in set expressions to make them
even more dynamic. We've previously discussed how variables alone are used. We
will now go through some examples of Set Analysis expressions that make use of
variables instead of hard-coded field values.
As before, we use the Dollar Sign Expansion syntax inside the field value definition
or element list. If, for instance, our variable contains a number, we would type the set
analysis expression as follows:
Sum({$<Year = {$(vLastYear)}>} [# Departures Performed])
On the other hand, of our variable contains text, our expression would be:
Sum({$<[Carrier Group] = {'$(vInterestGroup)'}>} [# Departures
Performed])
If we want to use a variable's value as a search string, the expression would be:
Sum({$<[Aircraft Group] = {"$(vSearchAircraftGroups)"}>} [# Departures
Performed])
We have just gone through a basic introduction on the topic, but there is a lot more to
know about Set Analysis. Let's move to the next part and discover some more of it.
Dynamic record sets
In the previous section, we reviewed some basic examples using set modifiers with
explicit (hardcoded) field value definitions. Our next step will be about making
our modified record set dynamic and based on the user's current selections, that is,
using a calculated field value definition. By doing so, the alternative record set will
dynamically change depending on what the user selects.
To embed actual calculations into the field value definition in a set expression, we use
the Dollar Sign Expansion (DSE) syntax. The final expression would be as follows:
Sum({$<Year = {$(=Max(Year))}>} [# Departures Performed])
As you can see, it is just as if we were using a variable, just with an additional equal
sign and the expression itself. Here, the DSE function is to evaluate the enclosed
calculation and the set expression will only use the output value in the set modifier.
We should never forget the equal sign when embedding
calculations in set expressions. Otherwise, the embedded
calculation will not be evaluated.
 
Search WWH ::




Custom Search