Ironside Tech Tip: Change Transformer File and Server Locations Using an MDL Script
When creating multidimensional models with IBM Cognos Transformer, many different types of data sources can be utilized such as reports, packages, Excel, and comma delimited files to design the model. Also various work environments may be used such as TEST, DEV, and PROD all of which have different server locations.
This article will discuss how users can copy a model to another environment and change file/deployment locations without physically typing in the information by using model definition language( MDL). This language is used to create, update, and manipulate Transformer models outside of the interface. The MDL file is text based and contains verbs, objects, and options used to alter models. Examples of verbs are CubeAdd, PopulateModel, and PowerCube delete.
The Great Outdoors Sales.mdl from the IBM Cognos Transformer 10.2.1 samples will be used for this simple demonstration with slight modifications. In order to change the model, the following items will be manipulated:
1. Great Outdoors Sales.mdl Transformer Model
2. Sales_reg.csv data source
3. PowerCube location
4. Deployment location
Open the PROD model and view current locations.
1. Open the Great Outdoors Sales.mdl file. Under Data Sources, open the properties of the Sales Region(csv) file. Note the file is in the PROD location. Later, it will be changed to reflect the DEV location. Close the dialog box.
2. Open the properties for The Sample Outdoors Co. powercube. Note its PROD location.
3. Click the Deployment tab. For this example, after the cube builds, it is deployed to the production server location.
4. Click OK to close the dialog box. As a developer, you have a need to test this model with a different Sales Reg.csv file. This test will be performed in the DEV environment. Instead of typing in this information, you can invoke an mdl script to do this for you.
Ensure DEV files are in the right location.
1. Copy the PROD model as is to the DEV location. Ensure your version of a sales_reg.csv file is in the proper DEV folder . In the example below, the .csv file is in the ‘Datasources’ folder and the copied model is in the Models folder.
Create an MDL script.
1. Open a text editor such as NOTEPAD and type the following:
2. Save the file as ChangeModelDev.mdl (note the extension is .mdl , not .txt . Since this is an .mdl file, it can be opened in Transformer).
Test the MDL Script
There are many ways in which you can test the script like put it in a .bat file: however, for our purposes you will do it the quick way.
1. Open the ChangeModelDev.mdl file in Transformer. If you typed the code correctly the model will open successfully. If there are errors in your code, the model will not open and you will have to find and correct them.
Note that the ChangeModelDev.mdl file is just a copy of the Great Outdoors Sales.mdl.
2. Open the properties for the Sales reg (csv), powercube, and the deployment locations. The mdl file just created a copy of the Great Outdoors Sales.mdl prod model with the requested property changes. See the example below.
3. Close the model and don’t save.
View changes in the DEV version of the Great Outdoors Sales.mdl File
1. Open the Great Outdoors Sales.mdl file that was copied to the DEV environment.
2. View the properties for the .csv file, powercube, and deployment locations. By just opening the ChangeModelDev.mdl in Transformer, the locations in this model were changed automatically to the DEV locations.
Again, this is just a simple example. For more information on how to use model definition language, refer to the Transformer MDL Reference guide at http://public.dhe.ibm.com/software/data/cognos/documentation/docs/en/7.5.0/pp_trns_mdl.pdf.
Ironside has a wealth of experience with both dimensional and relational data sources and metadata modeling practices in IBM Cognos BI. Check out our course catalog if you’d like to learn more.