Insert records in database and output stored data in database (SQL Server)
Who knows the step by step and sample code in inserting data into database and how to view the content of database in the UI Designer. I have 2 tables header and details. Please help. Please send sample code or sample bos file. Version of bonita is 7.4.2 Community Edition. I'm using sql server as database.
Have you tried the Database Connector? what were the results?
first this is a community - we all have work to do and do not get paid for contributing here (except those how work at Bonitasoft and they are not always here). Please do not get me wrong but we are more likely to help someone who has tried something than someone who obviously has not.
We do this out of the goodness of our heart, we get nothing...except some little recognition.
We all need to learn and the most important thing to learn is:
give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime
so if we give you the solution you will only use it for your dissertation but you will effectively learn nothing. We want you to learn and then use it forever. But that comes at a cost, you have to show us what you have done and then when there are problems we can help.
Harsh - maybe - realistic - absolutely.
I do not work for Bonitasoft just to make things clear.
However to get you started:
Who knows the step by step and sample code in inserting data into database and how to view the content of database in the UI Designer.
I'll show you how to use a connector first...to read
- Create a new diagram, rename it
- Change the diagram name to something meaningful
- Click on the pool->data tab and add a process variable myName, type text, default value Christian
- Click on Step1 and change it to a Script Task
- Click Execution->Connectors In->Add
- Select Database->yourDatabase
- Give a name->next->next
- give the necessary details->next
- In the Query add the following
- click next->next
- click the left box and create a new variable of type list
- then select the variable (double click) -> Finish
You can now execute this to get all records from yourDatabase with column contents 'Christian'.
To Insert you can change the Select statement to Insert...
For the rest - sorry but the community expects you to do something first then, when you have issues, ask.
PS: While I understand this may not be the answer you're hoping for, it does indicate a possible route to the solution, please mark as resolved.
PPS - the above select will of course not work - you have to resolve all details as to the data source and how to process the results.
If possible I would recommend to use Business Data Model (BDM) feature of Bonita BPM to handle your "header" and "details" objects. BDM let you create a model of your data that will be used to generate Java object for data manipulation in Bonita and also create database tables to store the data.
If instead you want to reuse an existing database, you will need as recommended by Sean to use database connector to write the data to the database and use a REST API extension (see the SQL data source REST API extension readme) to disaply the data in a form.
But i need to store data into my database and only data into the database will be viewed by user.