Hi,
I use Bonita BPM 7.3.1 local on Windows 7. I m novice at bonita
I have a question. I need to select some data sets from Oracle DB.
I d read a lot of topics at this forum and others.
And I resolve this problem like this:
-
I create Process Variable with type List
-
Then I create in Connectors In new Connector to my base with query , scripting Mode and assign to my process variable (type List) data from query result, by this script:
import java.util.logging.Logger;
import groovy.json.JsonBuilder;Logger logger= Logger.getLogger(“org.bonitasoft”);
int dI = 0;
//logger.severe(dI+ “Trace Start”)List myObjects = new ArrayList();
def builder = new JsonBuilder();while(resultset.next()) {
def myObject = builder{
id resultset.getObject(1).toString();
name resultset.getObject(2).toString();
}
dI++;
myObjects.add(myObject);
}
//logger.severe(“Before End:” + dI );
//logger.severe(“Trace End”);
//logger.severe("End: "+ myObjects);
return myObjects;
Later I send my Process variable to form , and use data from it in dropdown list by creating a variable on the form with External API type and ../API/bpm/activityVariable/{{taskId}}/myList
inside
So, my question is:
If I need for example 4 sets of data, like I wrote upper , should I make those things like I made ? Or maybe there is a symplier way to do this? The best option would be some script on the form, that would select data in dinamic, but I read that it’s imposible.