How to retrieve data from H2 database and save it in a form variable?

1
0
-1

Hello Bonita community,

My main goal is to make the form able to show suggestions when users type in using an auto-complete widget. To do so, I need to be able to get data from H2 database and save it in a form variable.

Now, I have a Customer Business Data Model. My goal is to retrieve data from this Customer H2 database and save it into my form variable called customersList. I know that one way to achieve this is through making a bdm api request. But, when I do, I don't receive any results.

This is my api request: ../API/bdm/businessData/ats.model.Customer?q=query1&p=0&c=10
This is what the chrome console shows:

Error-Request.png

This is my form:

Image-5.png

Here is the link to the official bdm api document: https://documentation.bonitasoft.com/bonita/7.9/bdm-api

Please help me. Thank you very much for your time.

1 answer

1
0
-1

I just figured it out. What prevented me from seeing the results is because I wrote the query wrong.
The query should be:
../API/bdm/businessData/ats.model.Customer?q=findByCustomerNumber&p=0&c=10&f=customerName=0001

I forgot to specify the customerNumber parameter. However, that arises a new problem. I can only query data that has customerNumber = 0001. I cannot specify a range value of customerNumber in the query. For example, I want to retrieve customer data that has customerNumber >= 0001 and customerNumber <= 0030.
How can I do it?

Thank you,
Virak

Notifications