DOMAIN
A domain is a segment, or a set of records chosen for a specific purpose. A database is made up of records, and these records internally form groups that have similar features. For example, a company’s customers can be female or male, but not both. For example, to specify the target audience for a marketing campaign, you can combine segments, such as females at age between 25 and 35, from Barcelona, and average purchasing power.
Domain can be defined as a simple query, or as a more complex set of segments. A Domain instruction must have the following syntax:
Syntax
DOMAIN [Target table] [Target column] [Domain]
Parameters
Target table
Defines a target table.
Target column
Defines a target column. Do not use the following characters:
/ \ º ª - accents, dieresis, ?, !, *, @, #, &, $, o, ñ
Domain
Defines a domain name. Specify a query that defines a domain, using any of the tools described in Table 5‑3.
Table 5‑3 Domain definition features
Icon
Tool
Description
Simple query
Defines a simple query. Allows you to create a query, by selecting database columns, and operations from the
database.
New block
Defines a new block of segments. A segment may contain multiple queries. A domain can be build of multiple blocks. The blocks act as parenthesis and define the order of execution.
Resolution
Changes the resolution of the whole domain or of a set of values entered in a block. For example, if you make a domain of records of people who are women and managers, and you want to see the households where the people who meet these conditions live, you can use this option to check the results in a dimension other than the source of the values.
Inversion
Inverts the selected value or values. For example, if you use Invert on a domain that contains the records of people that are women and managers, you get the records of people who are not women and not managers.
Discrete values
Selects the values that create the domain. Select a value from a column in the database.
Sorting
Sorts the values in a column in ascending or descending order.
Sample selection
Creates a sample of number of records.
You can find more information about domain features in Using BIRT Analytics.
How to create a domain
1 In Main File, choose New, and then Domain in the list of transformation instructions. Domain appears.
2 In Table, select the database, and the table from the drop-down list, or select the table in Repository and drag it to the column box.
3 In Column, type the new column name, as shown in Figure 5‑14.
Figure 5‑14 Creating a domain
4 In Domain, choose Click to select define a domain. Domain definition appears.
5 Create a new query, as shown in Figure 5‑15.
Figure 5‑15 Defining a domain
1 In Name, type the name of the domain.
2 Drag New query from the toolbar over New block, located on the left side of Name, as shown in Figure 5‑15.
3 In New query, select a database, a table, and a column, or drag a column from Repository.
4 In New query, select the operator, for example =, from the drop-down list.
5 Type a value, for example US.
6 Drag a New query to the New block to add a second condition.
7 Select the operator between the two conditions. If you wish to get the records for all women in US, you must select AND.
8 Select a database, a table, and a column for the second condition.
9 Select operator, and type or select a value for the comparison.
10 In Domain definition, choose OK.
6 In Domain, choose OK. The new domain instruction appears in Main file, as shown in Figure 5‑16.
Figure 5‑16 Creating a Domain instruction
7 Choose Save to save the project.
8 Validate the new column was created.
1 Choose Data Management, and then Explorer.
2 Expand the list of tables and columns in the Repository tree. The new Domain column, in this example FemalesUS, appears in the list. Select the column and choose View details to examine the new column properties and values, as shown in Figure 5‑17.
Figure 5‑17 Validating the new domain column