DEE Template Orders
This section provides an overview of DEE template orders.
Template Orders
DEE supports order templates. These templates are DEE Orders that you can pre-configure with placeholders, which can be filled in when executing the template order. Compared to a normal DEE Order, a template can contain placeholders that will be replaced by values provided at execution time.
The placeholders in the template order follow the below format:
{{placeholder_key}}
Template Orders Structure
Template orders have a name
element, which corresponds to the templateOrderName
path parameter of our PUT request when registering our template order.
Additionally, template orders have a priority
element, a queries
array, and an output
element.
Priority
The default priority is NORMAL
. We also have the following priorities in order of highest priority to lowest priority:
EXCEPTIONAL
CRITICAL
VERY_HIGH
HIGH
NORMAL
LOW
VERY_LOW
Queries
Within the queries array we have one element with a type
element, such as a GetAggregatesQuery
query.
For example, a GetAggregatesQuery
query allows us to describe the cube our query will be run against with the element: pivotId
, the levels in our query in
the element: locations
, and the measures included in our query in the element: measureSelections
.
For more information, see Extraction Queries.
Output
Output elements include filenameRoot
for output sub-directory and file name,
extractionProcedure
for using custom extraction procedures, and lastly columns
array, describing where each column will get its data.
We can also make use of template placeholders. Placeholders are defined in the template orders within the special characters {{
and }}
. For example,
our order can contain an MDX query with {{AS_OF_DATE}}
placeholder. Then when we execute our template order we can specify a value for the AS_OF_DATE
placeholder.
For more information, see DEE Order Values.
Output sub-directory and file name
The filenameRoot
element sets the subdirectory and the file name.
Columns
The columns
element allows us to describe how output columns will be populated.
The output file’s columns map to one of the following types:
- Level (
levelOutputColumn
) - Measure (
measureOutputColumn
) - Static value (
echoOutputColumn
) - Value which requires some logic (
extractProcValueOutputColumn
)
Executing Template Orders
Register Template Order
Template Orders can automatically be registered by adding the Template Order Json file into the data.extraction.templates.base.dir.path
directory.
Or the following services also expose methods to add/update and remove a template:
addTemplateOrder/{orderName}
- Registers the provided JSON DeeOrder provided in the REST body.removeTemplateOrder/{orderName})
- Removes a template order with the provided name
Below is an example of registering a template order through the REST services:
URL
.../connectors/rest/dee/VERSION/addTemplateOrder/MyNewTemplateOrder
JSON PUT Body
{
"name": "Any_Order_Name",
"maxMdxNbRetries": 2,
"priority": "NORMAL",
"queries": [
{
"@type": "MdxQuery",
"mdx": "select * from [cube] where {{MDX_FILTER_PLACEHOLDER}}"
}
],
"output": {
"@type": "fileOutput",
"columns": [
{
"@type": "levelOutputColumn",
"dimensionName": "dim1",
"hierarchyName": "hier1",
"levelName": "lvl1"
},
{
"@type": "measureOutputColumn",
"name": "measure1",
"format": "{{FORMATTER_PLACEHOLDER}}",
"valueIfNull": "N/A"
}
]
}
}
Here we have a placeholder in the MDX statement as well as in the Formatter of the measure output column.
Read more about DEE Order Structure.
Executing Template Orders
Template orders can be executed by calling the /submitTemplateOrders
endpoint and sending the JsonTemplateOrder object as seen below:
URL
.../connectors/rest/dee/VERSION/submitTemplateOrders
JSON POST Body
{
"templateOrderName": "MyNewTemplateOrder",
"templatePlaceholders": {
"MDX_FILTER_PLACEHOLDER": "Date=Today",
"FORMATTER_PLACEHOLDER": "##.##"
}
}