Using Deployment Scripts
By Kevin Hsu - Apr 29, 2013
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 update 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 ‘Current Month’ Variable. If you are not familiar with variables, refer to Application Variable article.
Step 1. Select Action node under Deployment in the navigation menu.
Step 2. Click Add button in the ribbon. Give the script a name and select its type. Here we are going to create a SQL script.
Step 3. Double click the script we just added, and click Edit button in the ribbon.
Step 4. Write script definition. Here we add SQL query to update the variable. Click Save. Done.
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. We always put to Process OLAP script at the bottom of the list so it will run at the end.