Page 1 of 1

TM1SystemProgressHookSet TM1 API

Posted: Mon Nov 02, 2015 2:02 pm
by speedy
Hello,

I execute a TI process by using TM1ProcessExecuteEx from the API. As a process can take a longer time, I would like to use TM1SystemProgressHookSet.
I have a callback function as described in the tm1_api.pdf

http://www-01.ibm.com/support/knowledge ... esshookset
void CALLBACK ProgressFunction( unsigned char message, unsigned char action, unsigned long param, char * name );
My code looks like that:

Code: Select all

Erg = TM1ProcessExecuteEx( pLocal, vProcess, hParametersArray );
TM1SystemProgressHookSet( hUser, ProgressFunction );
iType = TM1ValType( hUser, Erg );
I would like to write the progress of the TI process into a logfile. How can I get only the progress (percent completed or number of steps completed)?

Re: TM1SystemProgressHookSet TM1 API

Posted: Mon Nov 02, 2015 3:55 pm
by BrianL
That documentation is pretty bad, but what does your ProgressFunction code look like?

While the TI is running you should see the callback function get called periodically with updates. Since the callback function is only registered for a single user handle, you'll only get messages corresponding to the actions performed on that single user handle. You'll get separate TM1ProgressMessageOpening()/Running/Closing messages for each tab. Looks like the tab definitions for those actions aren't in the docs or TM1API.H header file, but they should be pretty easy to figure out from debugging/logging the parameters passed into your callback. When you get a message of value TM1ProgressMessageRunning(), the "action" value will specify which tab, the "param" value will specify which input record is being processed, and the "name" value will be the process name.

Re: TM1SystemProgressHookSet TM1 API

Posted: Tue Nov 03, 2015 9:11 am
by speedy
I am logging the action and param when the message is TM1ProgressMessageRunning()
The action is always 26. I tried to compare the action with the TM1ProgressAction constants defined in tm1api.h ( TM1ProgressActionLoadingCube(), ... )

Code: Select all

if ( action == TM1ProgressActionLoadingCube() )
{
	str += "LoadingCube: ";
}
else if ( action == TM1ProgressActionLoadingDimension() )
{
	str += "LoadingDimension: ";
}
but none of them is matching.
How can I figure out the meaning of the action?

Re: TM1SystemProgressHookSet TM1 API

Posted: Tue Nov 03, 2015 1:45 pm
by BrianL
Yeah, that one is not defined.

By using TextOutput in each tab to identify what the action codes are, I see that 26 == metadata tab, 27 == data tab, 33 == prolog, and 34 == epilog.