I would like to know how to return from my java code to a robotic process.
Hi everyone.
I would like to know how to return from my java code to a robotic process.
Refering the URL below, I write a program including getWorkflowParameters() method.
docs.appian.com/.../develop-java.html
■my java code
package com.novayre.jidoka.tutorial;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.time.LocalDateTime;
import java.util.Map;
import com.novayre.jidoka.client.api.IJidokaServer;
import com.novayre.jidoka.client.api.IRobot;
import com.novayre.jidoka.client.api.annotations.Robot;
import com.novayre.jidoka.client.lowcode.IRobotVariable;
/**
* My robot
* @author jidoka
*
*/
@Robot
public class MyRobot implements IRobot {
/**
* Server
*/
private IJidokaServer<?> server;
public void getAllRecordFromAccess() throws Exception {
Map<String, IRobotVariable> variables = server.getWorkflowParameters();
IRobotVariable rvAccessFileName = variables.get("strAccessFileName");
IRobotVariable rvGottenRecords = variables.get("rsGottenRecords");
IRobotVariable rvErrroMessage = variables.get("strErrorMessage");
try{
Connection conn=DriverManager.getConnection("jdbc:ucanaccess://" + rvAccessFileName);
Statement s = conn.createStatement();
ResultSet rs = s.executeQuery("SELECT * FROM DT_target");
rvGottenRecords.setValue(rs);
}catch( SQLException e ){
LocalDateTime ldtNoWTime = LocalDateTime.now();
System.out.println(ldtNoWTime +" : "+ e.getMessage());
rvErrroMessage.setValue(ldtNoWTime +" : "+ e.getMessage());
}
}
}
------------------------------
Also, I set 3 variables in the robot process.
・strAccessFileName : a value of MS Access file name to which is connected in order to get records in the Access'DB
・rsGottenRecords : a value of records gotten from the Access'DB
・strErrorMessage : a value of an error message my java code returns when an error arises.
<image>

I think getWorkflowParameters() and setValue() method lets myjava code return each value to a robotic process.
Are we on same page?

