I create a diagram that includes two processes illustrating two different solutions to initialize a drop down list (select widget).
First solution use a transient step data. The transient step data is a Text (java.lang.String) with option multiple active (becoming a java.util.List<java.lang.String>). The transient step data is initialized with a MySQL connector on enter of the step. Connector is configured to connect to the database and run a query that select one column in a database table. Content of the column will be saved in the transient step data. The data is used to defined the available values of the select widget.
Main limitation of this solution is that in case of server shutdown, if the task is pending, drop down list will be empty. In fact connector on step enter is only run once and transient data are not saved. A second limitation related to the fact that connector is only run once is that for a pending step, if database is updated, change will not be reflected in the drop down list.
The second solution is a lot more technical. It use a form transient data initialized with a Groovy script. Form transient data are initialized each time you load the form and so will reflect after a refresh any database modification. The Groovy script that initialize the form transient data instantiate, configure and run the MySQL connector programmatically. This workaround also require to manually add the MySQL connector jar file (and dependencies) in process configuration.
Note that the second option is a lot easier to use with Bonita BPM subscription editions as form transient data can be initialized using connectors.
the connector works if I use yours. But when I try to create my own connector, the last step is different from you. The connector does not recognize the city_name data field used in the query.
As data is already stored in MySQL database I assume that we don’t want to duplicate them.
Using a non-transient data would lead the Bonita Engine to store the data in database associated with the Engine and so would lead to duplication. Still this is a valid solution that should also cover the use case.
Yes I know, i adapted the query but I have a problem with the last step of my connctor. The connector does not recognize the name data fiels used in my query.
I have a table “patient” with a column “name”. so I have the Query : select name from patient.
but in the last step in the connector, the variable patient_name can not get the value of “name” as you did in your example.
In your connector configuration, you should select “Graphical mode” instead of “Script mode”. Select the option “n rows x 1 colulmn”.
I recommend you reconfigured you connector from scratch as an issue might exist if you just update the existing configuration (I’ll try to do more test).
Bonitasoft empowers development teams with Bonita, the open-source and extensible platform to solve the most demanding process automation use cases. The Bonita platform accelerates delivery of complex applications with clear separation between capabilities for visual programming and for coding. Bonita integrates with existing solutions, orchestrates heterogeneous systems, and provides deep visibility into processes across the organization.