Databases Reference
In-Depth Information
The exclusion operator ( - ) can also be used as a unary
operator to retrieve the complement set.
The set operators work in a manner similar to the assignment operators described in
the previous section. Let's review some basic examples:
Sum({$<Year = {2007, 2008} + {"<=2000"}>} [# Departures
Performed])
This expression will return the total flights performed in the years 2007 ,
2008 , plus all of the years that are less than or equal to 2000 .
Sum({$<[Carrier's Operating Region] = {'Latin America'},Year
= {2011}> + <[Carrier's Operating Region] = {'Domestic'},Year
= {2010}> - <[Carrier Group] = {'Foreign Carrier'}>} [#
Departures Performed])
This expression will result with the total number of flights performed during
2011 by carriers operating in Latin America plus flights performed during
2010 by carriers operating as Domestic , but exclude Foreign Carriers
from both sets.
This is one of those calculations that wouldn't be possible with
simple selections.
Just as in arithmetic operations, parentheses can be used to enclose different set
operations and ensure they are evaluated in the correct order.
Using element functions
There are two special functions that can be used in set expressions to implicitly
specify an element list. The functions are:
P() : To use all possible values in a field as the element list
E() : To use all excluded values in a field as the element list
A quick example:
Sum({1<Year = p(Year)>} [# Departures Performed])
This expression will use the full set of data disregarding all user selections
(because the specified set identifier is the number 1 ), but take into account
those records corresponding to the years that the user has selected. In other
words, only selections made on the Year field are considered.
 
Search WWH ::




Custom Search