DatasourceNameForServer and DatasourceNameForClient TM1 Functions: Use and Syntax

Ever wondered how you can vary the data source for a Turbo Integrator process inside the actual process so it becomes dynamic? Well here is a method.

Firstly, define a bunch of variables:

sCurrentMonth = CellGetS ( 'System Assumptions', 'No Year', 'No Month', 'Current Month', 'String' );
sFileDir = '\\servername\folder\';

sFileName = sCurrentMonth | ' ' | SUBST(sCurrentYear,3,2) | ' Employees.csv';
sFilePath = sFileDir | sFileName;

Then use DatasourceNameForServer and DatasourceNameForClient to force the TI to use specific files for both the Datasource Name for the server and for the client.

DatasourceNameForServer = sFilePath;
DatasourceNameForClient = sFilePath;

Why is this useful?  Well there are a couple of reasons:

  1. Where you have a file that is being automatically created and includes (in our case) the month and year in the filename, this is very useful.  It then allows us to keep historic versions of the source files in case we need to reload them.
  2. If you have a Dev and Prod environment, for example, you could have the server name as an entry in a System Assumptions cube and then retrieve it from System Assumptions and use it dynamically in a TI.
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 site uses Akismet to reduce spam. Learn how your comment data is processed.