How to write dynamic query in bonita studio bdm?

1
0
-1

I have five filter fields in my application home page (dashboard -> where I am showing all the records from h2 DB) now I want to filter the records on these fields basis.
It may require 31 (2^5 -1) queries, some are already provided as default queries.

Isn't there a way to write a dynamic query in "custom queries" or somewhere to get the desired result at UI?

Things I have tried:
- get all the records and apply javascript filters (not a good approach)
- e.g. In query "findByFirstName" when retrieving records on the basis of firstName, I also pass
 " 'firstNameHere' AND <someOtherFieldFromSameTable> = 'something' "
this doesn't work.

1 answer

1
0
-1

Hello,

I think you should define "custom queries" in the BDM, it is introduced in the documentation here .

Once created, a custom query can be executed using the default REST API .

HIH,

Comments

Submitted by asad.shakeel_1381337 on Wed, 10/17/2018 - 17:41

That's easy...
But I want some **dynamic query** i.e. at runtime to build the query on the basis of some fields.
e.g. append **AND** clause with some other attribute.

P.S: can't comment for now

Submitted by pierrick.voulet on Wed, 10/17/2018 - 21:41

Makes sense.

For a semi-dynamic query, parameters could be helpful.

But there is nothing to execute JPQL using default APIs. What you could do is to create a Bonita Command ( javadoc ) to extend the default Java API of Bonita and come with an implementation that would leverage the Business Data Service . Here is a Bonita architecture overview in case you want to learn a bit more about this.

Submitted by alex_1395422 on Thu, 05/02/2019 - 14:40

Did you ever find a good solution to this? I've also reached this limitation and am unsure how to move forward.

Notifications