Selecting multiple set of data from Oracle db


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:

  1. I create Process Variable with type List
  2. 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( {

    def myObject = builder{
    id resultset.getObject(1).toString();
    name resultset.getObject(2).toString();
    //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.

1 answer

This one is the BEST answer!

Use the KIS principle. Keep it simple. This works so just duplicate it and use it.

There is a way to do it on the form but believe me it is far more complex than this.

We do it both ways and they both have advantages, but in all honesty, do what works for you and keep it simple.


Ps if this answers your question please mark as resolved.


Submitted by Xvz88 on Tue, 08/09/2016 - 21:28

Thanks Sean!
A for my education, where can I read about second option?

Submitted by Sean McP on Wed, 08/10/2016 - 06:02