Fill table from mysql

1
0
-1

Hi,

I try to show in a Table thez result of a query in mysql.

Table : Id, titre, description, date_ajout

I woul'd like to show the result in the table row by row like that:

1 | titre1 | desc1 | 2016-02-19
2 | titre2 | desc2 | 2016-02-19
3 | titre3 | desc3 | 2016-02-19

And not

[1,2,3] | [titre1,titre2,titre3] | [desc1,desc2,desc3] | [2016-02-19,2016-02-19,2016-02-19]

How can I do that?

Regards
BLE

1 answer

1
0
-1

YOu have to format the data as JSON...have a look at the Getting Started Tutorial that shows you the correct format (this first section)

regards
Seán

PS: If this reply answers your question, please mark a resolved

Comments

Submitted by ble on Tue, 03/01/2016 - 08:14

Hi,

I take a look at that, but I'm not using the UI form but the native form of bonita!

Anyways to change the values with groovy script?

Regards
BLE

Submitted by Sean McP on Tue, 03/01/2016 - 10:24
Submitted by ble on Tue, 03/01/2016 - 11:37

Hi,

Thank's for the link,

I try the script but it's not working, maybe it comes from the variable.

What kind of variable must I use? I use a java.util.List

And I put the script in a connexion in for a Mysql connexion

I put this request : SELECT "titre", "description" FROM demo
At the last screen I choose the variable listoftitre (java.util.List) take value of resulset, I edit and I put this code in script :

import groovy.json.JsonBuilder;

List<Object> booktable = new ArrayList<Object>();

while (resultset.next()){

    def builder = new JsonBuilder();

    def line = builder {
        titre resulset.getString("titre");
        description resulset.getString("description");
    }
booktable.add(line);

}
return booktable;

When I run, the form isn't available.

Thank's

Notifications