TM1 Archive TI Process

I asked Mafia Man the other day how I can take a backup on the fly of everything in TM1 so that if I make changes and stuff up, I can easily restore from my backup.

He gave me the following code that is to be inserted in the Prolog tab under Advanced in a Turbo Integrator process.  This creates a full archive of a TM1 Model (in this case CXMD) out to a zip file that will not be overwritten the next time the process is run as it is date time stamped in the file name.

#****Begin: Generated Statements***
#****End: Generated Statements****

### Saves all data from memory and sets up the variables
SaveDataAll();

### Assumes that 7-zip is installed at the defined location
sExec = ‘C:\Program Files\7-Zip-A\7za.exe’;

### Defines the target folder for the backup
sBackupDir = ‘C:\TM1_Backups\’;

### Defines the source folder for the model to be backed up
sDataDir = ‘C:\Program Files\IBM\Cognos Express\Xcelerator\Custom\TM1Data\CXMD\’;

### Defines the name to be used for the backup zip file
sFileName = ‘Data ‘ | TIMST(NOW(), ‘\Y\m\d \h.\i’, 1) | ‘.zip’;

### Defines the arguments to be used with the zip command
sArgs = ‘ a -tzip ‘;
sCommand = sExec | sArgs | ‘”‘ | sBackupDir | sFileName | ‘” “‘ | sDataDir | ‘*”‘;

### Outputs the variables to a text file for debugging
#ASCIIOUTPUT (‘c:\debug-save.txt’, sexec, sbackupdir, sdatadir, sfilename, sargs, scommand);

### Creates the zip
EXECUTECOMMAND (sCommand,0);

 

If you like this post, please spread the love…

About John

Managing Director of Infocube. We are a management accounting consultancy that specialises in Business Analytics.
This entry was posted in TI Processes. Bookmark the permalink.