Deployment Scripts allow the Modeler to customize the deployment process by issuing a set of XMLA or SQL commands upon each Deploy to OLAP action.
We can use the Deployment Script feature to automate certain tasks such as:
- Dynamically updating the Current Month variable
- Auto-validate and correct Dimension attribute values
- Sync data such as exchange rates from source system
By default, the Process OLAP Deployment Script is created as part of the application and used during the Deploy to OLAP action to generate and process the application.
How to Create a Script
We will explain how to use a script to dynamically update the Current Month variable. If you are not familiar with variables, refer to this article.
Step 1. Select the Scripts node under Deployment in the right-hand navigation menu in the MODELER.
Step 2. Click the Add button in the ribbon. Give the script a name and select its type. Here we'll create a SQL script.
Step 3. Double-click the script we just added and click the Edit button in the ribbon. Write the script definition. Here we can add a SQL query to update the variable. Click Save .
How to Run These Scripts
Deployment Scripts will run every time we deploy the application. Please note, the ordering of the scripts will determine the sequence of execution. Use the up/down arrow keys to adjust as necessary. You should always put the Process OLAP script at the bottom of the list, to ensure it runs at the end.