5.10.1 getting data from list field

I am extracting from a MS SQL database data to a field which is set to “Text” and “Mutiple”.

Data extract connector works, and Connector output is set to have “rowSet.getValues() goes to ” with APPEND set.

Data appears in the format [[,,], [,,],[,,]]

Can anybody point out an example of how all of the rowSet can be converted into a list/string that I can use in another script not only for display, but for export to a CSV file ( the rest of the CSV file creation and export is done).

I’m sure it’s fairly easy for experienced Java/Groovy devs, but so far the answer has eluded me!

Cheers

Lawrence

For example, this code working at BOS 5.1

At table or editable grid -> General -> Data -> set values and put this code into 'table values'


import groovy.sql.Sql;
import providedscripts.BonitaSql;

def list = [];
List<List<String>> output = new ArrayList<List<String>>();
def url="jdbc:oracle:thin:@192.168.0.1:1000:xxx";
def driver = new oracle.jdbc.driver.OracleDriver();
def query = "select 'country' country,'code' code,'name' name,1 cnt from dual"
sql = providedscripts.BonitaSql.newInstance(url,"tehno","tehno",driver);
sql.eachRow(query,{
    list += it.country;
    list += it.code;
    list += it.name;
    list += it.cnt;
    output.add(list)
    
    list = [];
    }
)

sql.close()

return output;

Wrong copied )

change this: List> output = new ArrayList>();

to

List<List<String>> output = new ArrayList<List<String>>();

In a ‘Scripting’ connector

Incoming field is java.util.list

List> myList = newData;
String stringRow=“”;
for (List row : myList){
for(String i : row){
stringRow += i + “;”;
}
stringRow+=“\n”;
//Write to a file

}
return stringRow;

Then in the next tab use the Connector output ‘result’ goes to , where is a text field.

Thanks to Pablo Alonso de Linaje for providing that answer - I’m adding it here for others to find!