Page 1 of 1

Execute TI Process over TM1 JAVA API

Posted: Wed Apr 20, 2011 2:05 pm
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);
    }
}

Re: Execute TI Process over TM1 JAVA API

Posted: Wed Apr 20, 2011 7:03 pm
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!

Re: Execute TI Process over TM1 JAVA API

Posted: Wed Apr 20, 2011 8:36 pm
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

Re: Execute TI Process over TM1 JAVA API

Posted: Sat Jun 07, 2014 5:12 pm
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.