Postgres query result (List of lists) fills only the first column in form Table
I am a new to java and Bonita (although not to BPM) and I am trying to display a sql query result in a standard Bonita UI table version 7.1 (using the Table widget). But all the data ends up in the most left column like this example below:
What did I do to get to this?
I defined a postgresql dataconnector, that shows a working Array when testing:
The output (graphical n*n) is saved in a List type variable 'carsandcolors':
And in the UI designer I defined a variable 'Cars' that receives the data from 'carsandcolors' through the API:
../API/bpm/activityVariable/{{taskId}}/carsandcolors
I have made the following settings in de UI designer:
Why are the subarrays listed in the first column only? And what can I do to fix this?
I have the feeling it has something to do with the Column Keys attribute in the UI designer, but I cannot find any information on how to use this attribute.
Any help is greatly appreciated!
Use this tool to check JSON: JSON validator
The variable "jsonb" must be defined after the While and also the line before of the "line" variable definition.
Thanks stefandebruijn!
Do you guys have an idea about how to do a query depending on a UI designer selector option?
Imagine that you have a table with the fields "brand", "color", "year", "type", etc... So you want to filter the content of the table based in the option you've selected.
I'm thinking that I have to use the selector's output, but I don't know if I can do the interaction selector-connector in that way.
Hi Stefandebruiji. Where did you write the groovy script? I defined a connector I did the query test and it works. Should I create a new variable and write the script?
Comments
I am not a developer, but i guess there are some ways to achieve what you need:
1) query directly from to form on your database (through rest api, outside bonita) I do not know how to do this, depends also on your database.
2) load all the data into your form and add a filter in the result table. The filter value should be bound to the value of your selector (search angular js filter). This works pretty good. I can give you an example if you need.
3) select the data in the selector, submit the form, query the database with the selector value, activate new form in new task and return the query result to the new form (not
Probably there are better options, Mayby you can post your question as a new one.
rgds, Stefan
I'm trying to do this in the same task.
Please, I really appreciate it, give me a filter example.
Ok, this is working for me:
1) Create an empty String variable in de UI designer and call it varFilter (for example)
2) Bind the output value of your selector to this variable. So if you select a value, that value is assigned to variable varFilter
3) Add the filter to your table by adding a pipe and filter:varFilter to your table dataset. Like this: yourTableInputVariable | filter:varFilter
This is done in the file 'content' for a table or 'repeat contents' for a container
This is basic angularjs. You can search google for other angularjs filter examples,
Good luck
Thanks it works great!