Execute TI Process over TM1 JAVA API

Post Reply
tm1jonny
Posts: 4
Joined: Wed Apr 20, 2011 1:53 pm
OLAP Product: tm1
Version: 9.5.2
Excel Version: 2003

Execute TI Process over TM1 JAVA API

Post by tm1jonny »

Hi All
I try to start a Process with JAVA-API. But do not succeed. Login and Counting Objects works great, but I don't know how to execute a process.
Does someone has a clue ?

Regards

Here is my sample code:

Code: Select all

public class ExecuteTM1Process {

    public static void main(String[] args) {
        TM1Val bool;

//      TODO Auto-generated method stub
        int port = 5498;
        int port2 = 5495;
        String sHostname="myhost";
        String sTM1Server="myserver";
        
        TM1Bean bean = new TM1Bean();
        TM1Server tm1serv = new TM1Server();
                
        bean.setAdminHost( sHostname );
        
        bean.setAdminPort( port );
        //bean.openCAMConnectionWithNamespace();
        tm1serv = bean.openConnection (sTM1Server, "admin", "");
        
        TM1Process tm1p=tm1serv.getProcess("TEST_PROCESS");
        
        if (tm1p.isError()){
            System.out.println (tm1p.getErrorMessage());  // DOESN'T GO THROUGH HERE, SO THE PROCESS TEST_PROCESS IS AVAILABLE
        }else{
            bool = tm1serv.getProcess("TEST_PROCESS").check();
            
            System.out.println( bool.getErrorMessage());  / NO ERROR
            tm1p.execute(new TM1Val("true"));	// HOW CAN I START A PROCESS
        }
        System.exit(1);
    }
}
Last edited by tm1jonny on Wed Apr 20, 2011 8:34 pm, edited 1 time in total.
csjean
Posts: 40
Joined: Mon Mar 01, 2010 2:53 pm
OLAP Product: TM1
Version: 9.5 9.5.1 9.5.2
Excel Version: 2007

Re: Execute TI Process over TM1 JAVA API

Post by csjean »

Hi,

You have to use a TM1Val Array as parameter to you execute method.

Code: Select all

  TM1Val pArray = TM1Val.makeArrayVal(1);
  pArray.addToArray(new TM1Val("true"));
  tm1p.execute(new TM1Val("true")); 
This should work (although I haven't had time to check it)...

Cheers!
Cheers!

--
Claude-Sebastien Jean
Senior Consultant in Information Technology
Keyrus Canada
www.keyrus.ca
tm1jonny
Posts: 4
Joined: Wed Apr 20, 2011 1:53 pm
OLAP Product: tm1
Version: 9.5.2
Excel Version: 2003

Re: Execute TI Process over TM1 JAVA API

Post by tm1jonny »

Thanks for reply

if i do not have any parameters how do i call the tm1p.execute

tm1p.execute(null) ?

For what are these parameters ? I do not have any parameters.

Regards
wilsonmax
Posts: 34
Joined: Fri Feb 28, 2014 2:21 am
OLAP Product: TM1
Version: 10.1.0
Excel Version: 2010

Re: Execute TI Process over TM1 JAVA API

Post by wilsonmax »

tm1jonny wrote:Thanks for reply

if i do not have any parameters how do i call the tm1p.execute

tm1p.execute(null) ?

For what are these parameters ? I do not have any parameters.

Regards
I haven't tried the code yet.

But, I suggest you creating a new process, like a package, to cover your "real" process.
Post Reply