Page 1 of 1

MS Access Code to execute process

Posted: Mon Jul 02, 2012 10:07 am
by Mems
Hey All,

I would like to insert a piece of vb code into MS Access to execute a Tm1 process.
If anybody knows the syntax for this. It would be much appreciated.

Regards,

Re: MS Access Code to execute process

Posted: Mon Jul 02, 2012 3:19 pm
by Lukas Meyer
Since no client uses access I had to google if bat-scripts may be executed via access: http://bytes.com/topic/access/answers/4 ... oft-access (apparently yes)

If you can indeed call bat-scripts (and this is applicable in your case), have a look at runti.exe http://www.tm1forum.com/viewtopic.php?f=3&t=5176
(especialy the 5th post, which contains the documentation) runti.exe is available since 9.5.2 HF1 but should work fine for older versions if you can get your hands on the exe.

copy this to a bat file to create the pwd and key file (I usually get confused which is which so I made the script. yes, I'm that lazy)

Code: Select all

@echo off
set base_path=%~dp0
set tm1crypt="C:\Program Files (x86)\Cognos\TM1\bin\tm1crypt.exe"
set /P user=Username:
set /P pswd=Password:
set tm1crypt_arguments=-pwd %pswd% -keyfile "%basepath%tm1crypt_%user%_pwdkey.txt" -outfile "%basepath%tm1crypt_%user%_pwd.txt" -validate

%tm1crypt% %tm1crypt_arguments%

pause
(at least the .bat will attempt to create the files at the folder it resides in. if you put it at c:\, run it as administrator. obvious? I got bothered with this twice this week. it's still Monday over here. Weeks do start with Monday.)

then use

Code: Select all

@echo off

rem set tm1adminhost=
set tm1server=cubica_test1
set tm1user=api
set pwd_path=C:\Users\lukasm\Documents\TM1_TABS\cubica_test1\
set tm1runti="C:\Program Files (x86)\Cognos\TM1\bin\tm1runti.exe"


set pwd="%pwd_path%tm1crypt_%tm1user%_pwd.txt"
set pwdkey="%pwd_path%tm1crypt_%tm1user%_pwdkey.txt"
set tm1runti_params=-process SYS_SecurityRefresh -adminhost %tm1adminhost% -server %tm1server% -user %tm1user% -passwordfile %pwd% -passwordkeyfile %pwdkey% 
@echo on
%tm1runti% %tm1runti_params%
This script runs the process "SYS_SecurityRefresh" as user "api" with password information found at pwd_path
If your process has arguments, see the mentioned documentation - it should be easy to add.

Re: MS Access Code to execute process

Posted: Mon Jul 02, 2012 4:51 pm
by tomok
Lukas Meyer wrote:runti.exe is available since 9.5.2 HF1 but should work fine for older versions if you can get your hands on the exe.
I'm pretty sure that is not true although I have not tested it. New TM1 features are almost always never backward-compatible.

Re: MS Access Code to execute process

Posted: Mon Jul 02, 2012 8:28 pm
by jim wood
Tomok,

I'm guessing that RunTi accesses the API in a similar way to the batch files created on this site before it existed. It may work but I think it's not designed to so you may be right. Instead of using RunTi use the batch files from this site (available in helpful code) that are free and are know to work on multiple version,

Jim.

Re: MS Access Code to execute process

Posted: Wed Jul 04, 2012 3:44 pm
by Mems
Hey All,

Thanks for the replies.

We are running TM1 v9.5.2 HF2 at the moment. (Upgrading to 10 in the next couple of months).

So I guess the RunTi.exe will work?

I will test and give feedback.

Thanks!!!

Re: MS Access Code to execute process

Posted: Mon Jul 09, 2012 7:37 am
by Mems
Hey All,

Thanks everything worked perfectly.

Regards,