Constructions are used to create new items or variable types in a project. New variables can be created using items that already exist in the project, or with user entered values.
A new variable can be created by first selecting the desired position in the project tree, choosing one of the options under construct from the design menu Learn more about the design menu. and then defining the expression in the editor.
Constructions can use items in one or many sources. Once created, constructions are automatically updated when new sources are added.
Construction variable types include:
1. Expression Editor
The expression editor is the interface by which the new item definition is entered. The expression editor supports both typing and drag and drop to build the expression.
- The possible options are displayed for selection. Use the arrow down key to highlight the option choice, and Enter to select it.
- The possible matches are only displayed when they are similar, not identical.
- The most reliable way of including an item in a complex definition is through typing to display the list of matching labels, then selecting them from the displayed list.
- An element can be defined using a single Axis.Element condition by dragging a single element into the expression editor.
- Dragging in more than one element from the same axis into the definition assumes an or relationship across elements
- Dragging in elements from different axes into the definition assumes an and relationship
2. Expression Editor Syntax
Existing elements in the dictionary are used in the definition. The syntax is:
Multiple elements within the same axis can be used. The syntax is:
- Axis.(Element 1 or Element 2)
When an expression is saved the quotes may be stripped (they’re only required when the label contains special characters such as commas, brackets. etc.)
3. Expression Editor Operators
a) Boolean logic operators
Boolean logic operators and, or, not and brackets are all available when defining standard elements.
- And decreases the number of data records included.
- Both conditions in an and relationship must exist in at least one source, or no records will be included in the construction.
- Or increases the number of data records included.
- Not all conditions in an or relationship need to exist in any one source for records to be included in the construction.
- Not is to be used with either and or an or operator.
- The definition after not must include the axis name before the element name.
Standard_Axis_Name.("(ElementName1)" or "(ElementName2)") and not Standard_Axis_Name."(ElementName3)"
- Brackets are used to determine the order of calculation.
b) Comparative Operators
Measures can also be used in the definition of an element. When using measures, the condition is still identifying the condition that must be true in order for data records to be included in the new element. A comparative operator must be used when using a measure to define an element, these include:
- Greater than >
- Less than <
- Less or equal <=
- Greater or equal >=
- Not equal <>
- Equal =
Let's assume you want to create a new "Target Segments" axis with the following elements:
- Frequent Flyer Retirees = 65+ years who visited the moon more than twice.
- Coast Focused Females = Females who visited a beach and a marine park/reserve, but didn't visit a geothermal park, glacier, national park, or hot pools.
4. Conditions and Functions
a) If statements
Used to populate a new measure or weight with a different value depending on specific conditions
- The syntax for the if statement is:
if (Logic_Test, Value_if_True, Value_if_False)
- The syntax for a nested if statement is:
if (Logic_Test, Value_if_True, if (Logic_Test, Value_if_True, Value_if_False))
Let's assume you want to weight Males and Females to a 50/50 distribution. Across all sources, the Male/Female distribution is 45/55. To change this to 50/50 we need to assign all males a weight of 1.111 (50/45) and all females need a weight of 0.909 (50/55).
b) Count responses
A measure counting responses in a standard axis can be created using the count function
- The syntax for the count function of a measure is:
Count function can also be used to turn an element into a numeric representation of 0 or 1.
- The syntax for the count function on an element is;
Measures can also be defined using calculations, i.e.
- Addition using +
- Subtraction using -
- Multiplication using *
- Division using /
Let's assume you want to create an "Other Costs" measure containing the amount spent that wasn’t on airfares or packages, i.e. the amount left after subtracting airfares and packages from total spend.
5. Save and Apply Expression
Once you have defined your new items in the expression editor Save Expression and Apply Expression will become active. This will only happen when Infotools Harmoni validates the conditions you have entered.
Save Expression will save your definitions but won't update data. To improve the workflow and efficiency when creating your custom variables, you can save your definitions as you go but only apply when you are ready.
When an expression is saved the quotes may be stripped (they’re only really required when the label contains special characters such as brackets).
Data is only updated in new items when Apply Expression is applied to the axis.
Save Expression allows you to modify multiple expressions by delaying the data parse until you choose to apply. This gives the ability to control the actual moment that it gets applied.
Where to from here?
Learn more about different construction types.