# 5.10.1 getting data from list field

**URL:** <https://community.ofelia.com/t/5-10-1-getting-data-from-list-field/4029>\
**Category:** Q&A\
**Created:** [17 December 2013 12:50 UTC](https://community.ofelia.com/t/5-10-1-getting-data-from-list-field/4029 "2013-12-17T12:50:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lawrence.attrill](https://avatars.discourse-cdn.com/v4/letter/l/e56c9b/32.png) [@lawrence.attrill](https://community.ofelia.com/u/lawrence.attrill)\
**Post date:** [17 December 2013 12:50 UTC](https://community.ofelia.com/t/5-10-1-getting-data-from-list-field/4029/1 "2013-12-17T12:50:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Lighting](https://avatars.discourse-cdn.com/v4/letter/l/aeb1de/32.png) [@Lighting](https://community.ofelia.com/u/Lighting)\
**Post date:** [19 December 2013 14:39 UTC](https://community.ofelia.com/t/5-10-1-getting-data-from-list-field/4029/2 "2013-12-19T14:39:14Z")

</div>

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,{  
&nbsp;&nbsp; &nbsp;list += it.country;  
&nbsp;&nbsp; &nbsp;list += it.code;  
&nbsp;&nbsp; &nbsp;list += it.name;  
&nbsp;&nbsp; &nbsp;list += it.cnt;  
&nbsp;&nbsp;&nbsp; output.add(list)  
&nbsp;&nbsp; &nbsp;  
&nbsp;&nbsp; &nbsp;list = [];  
&nbsp;&nbsp; &nbsp;}  
)

sql.close()

return output;

---

<div class="post-metadata">

**Author:** ![Lighting](https://avatars.discourse-cdn.com/v4/letter/l/aeb1de/32.png) [@Lighting](https://community.ofelia.com/u/Lighting)\
**Post date:** [19 December 2013 14:41 UTC](https://community.ofelia.com/t/5-10-1-getting-data-from-list-field/4029/3 "2013-12-19T14:41:51Z")

</div>

Wrong copied )

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

to

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

---

<div class="post-metadata">

**Author:** ![lawrence.attrill](https://avatars.discourse-cdn.com/v4/letter/l/e56c9b/32.png) [@lawrence.attrill](https://community.ofelia.com/u/lawrence.attrill)\
**Post date:** [19 December 2013 15:34 UTC](https://community.ofelia.com/t/5-10-1-getting-data-from-list-field/4029/4 "2013-12-19T15:34:55Z")

</div>

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!
