In Harmoni, a standard axis is a discrete or categorical variable with elements for each response. They can be single or multi-response.
You can create new axes and elements in several ways in Harmoni and this article focuses on creating customized constructions using the expression editor.
In this article
1. Create a New Item using the Expression Editor
a. Construct a New Axis
You can create a new axis from other axes, measures, or weights.
- Select the desired position in the project tree and then click new axis from the design menu.
- In the project tree, the new axis appears above the selected item.
- The new axis is not saved in the project tree until the axis has a name, and there is at least one named element.
- After naming your new axis and the first element, the expression editor automatically opens for you to enter the definition.
The following two examples show the creation of a standard axis and a time axis.
Standard Axis
- Select the desired position in the project tree by selecting an item
- Click new axis
- Name your new axis and new element and expression editor opens
- Click into the text field and begin typing to define
- Once ready, click Apply Expression
For Creators with auto syncAuto sync controls whether changes are applied immediately or saved for later. Learn more. off, or Explorers, Save Expression is also available. Data is only updated in the new items when Apply Expression is applied to the axis.
Learn more about Save and Apply Expression.
Time Axis
In this example, a Quarter time period is created by combining three time elements together.
- Select the desired position in the project tree by selecting an item
- Click new axis
- Name your new axis and new element and expression editor opens
- Define the Quarter time periods in the expression editor - here we use drag and drop
- Add the date flag to the axis
- Once ready, click Apply Expression
When creating a time axis, you can apply a date flag to ensure that Harmoni recognizes this variable type.
Learn more about the benefits of applying a date flag.
b. Construct a New Element
You can add new elements to existing axes. New elements can be added to variables that have come directly from the source or constructed in new user-created variables.
- Select the axis and position in the project tree and then click new element from the design menu.
- In the project tree, the new element appears below the selected item.
- After naming your element, the expression editor automatically opens for you to enter the definition.
- After defining an element and applying the expression, there is also an option below the definition to add a new element. This allows you to easily create as many elements as needed.
- Select the desired position in the project tree by selecting an element
- Click create new element
- Name your new element and press Enter
- The expression editor opens and you can click into the text field and begin typing
- Once ready, click Apply Expression
- After defining an element there is an option below the definition to add a new element.
2. Save and Apply Expression
After a Project Owner defines a new item, Save Expression and Apply Expression become active (turn green) if the definition is valid and auto sync is off. Only Apply Expression is available with auto sync on.
Explorers and non-owning Creators always see both the Save Expression and Apply Expression options.
- Harmoni validates the conditions you have entered. The element definition should specify the condition that must be true for the data records to be included in the element. If the definition is not valid, you won't see the save or apply expression buttons turn green.
- To improve the workflow and efficiency, after defining an element, you can keep adding elements and saving the definitions, but only apply the expression when you are ready.
Save Expression saves the definition but doesn't update the data. The data updates in new items when Apply Expression is applied to the axis.
Where to from here?
Learn more about constructions: