Here we want to create a query with an Enumerations type calculated field. This field will generate an additional column in the data preview window. This column will specify the numeric values returned as a result for each recipient (0, 1 and 2). A gender will be assigned to each value in the new column: “Male” for “1”, “Female” for “2” or “Not indicated” if the value equals “0”.
Which table needs to be selected?
The recipient table (nms:recipient)
Fields to be selected in the output column?
Last name, First name, Gender
Criteria which the information will be filtered based on?
The rrecipient language
Apply the following steps:
Open the Generic query editor and select the Recipient table (nms:recipient).
In the Data to extract window, select Last name, First name and Gender.
In the Sorting window, click Next: no sort is necessary for this example.
In Data filtering, select Filtering conditions.
In the Target element window, set a filter condition to collect recipients who speak English.
In the Data formatting window, click Add a calculated field.
Go to the Type window of the Export calculated field definition window and select Enumerations.
Define the column which the new calculated field must refer to. To do this, select the Gender column in the drop-down menu of the Source column field: the destination values will coincide with the Gender column.
Define the Source and Destination values: the destination value makes the query result easier to read. This query should return recipient gender and the result will either be 0, 1, or 2.
For each “source-destination” line to be entered, click Add in the List of enumeration values:
Select the Keep the source value function.
Click OK to approve the calculated field.
In the Data formatting window, click Next.
In the preview window, start the preview of the data.
The additional column defines the gender of 0, 1 and 2:
For example, if you don’t enter gender “2” in the List of enumeration values, and the Generate a warning and continue function of the In other cases field is selected, you will get a warning log. This log indicates that gender “2” (Female) has not been entered. It is displayed in the Logs generated during export field of the data preview window.
Let’s take another example and say that enumeration value “2” isn’t entered. Select the Generate an error and reject the line function: all gender “2” recipients will raise anomalies and the other information in the line (first and last name, etc.) will not be exported. An error log is displayed in the Logs generated during export field of the data preview window. This log indicates that enumeration value “2” isn’t entered.