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

**URL:** <https://community.ofelia.com/t/how-to-retrieve-data-from-h2-database-and-save-it-in-a-form-variable/9714>\
**Category:** Q&A\
**Created:** [27 June 2019 08:29 UTC](https://community.ofelia.com/t/how-to-retrieve-data-from-h2-database-and-save-it-in-a-form-variable/9714 "2019-06-27T08:29:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![singhtaravirak\_14025](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@singhtaravirak\_14025](https://community.ofelia.com/u/singhtaravirak_14025)\
**Post date:** [27 June 2019 08:29 UTC](https://community.ofelia.com/t/how-to-retrieve-data-from-h2-database-and-save-it-in-a-form-variable/9714/1 "2019-06-27T08:29:24Z")

</div>

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](https://i.postimg.cc/028QqMkX/Error-Request.png "API Request")

This is my form:

![Submitted Form](https://i.postimg.cc/3RcPfqwH/Image-5.png "Submitted Form")

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

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

---

<div class="post-metadata">

**Author:** ![singhtaravirak\_14025](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@singhtaravirak\_14025](https://community.ofelia.com/u/singhtaravirak_14025)\
**Post date:** [28 June 2019 03:14 UTC](https://community.ofelia.com/t/how-to-retrieve-data-from-h2-database-and-save-it-in-a-form-variable/9714/2 "2019-06-28T03:14:10Z")

</div>

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
