Range of dates as params in query

1
0
-1

Hi,
I'm newer user of Bonita and I'd want to know how passing parameters as date in an URL to show a table filtered between dates. I have a table (entity) with a date field and my objectif is have a filtered view. I've done a custom query using this field. I've tried with a form with 2 datepickers but I don't know how transmettre these variables into the query to show the result. Must I convert these variables (stringtodate) ? where? Must I create an other forms with the resulting view? Is it necessary a process task? Is there any good simple example? Thanks

1 answer

1
0
-1

Hi,

You can pass a date as a URL param as long as you respect the ISO 8601 format.

By example, let's say your date picker takes the variable "dateIn" as a value. You can add a form variable "URL param" and call it "dateIn". This value will read the param name you specify in the variable. Then you can use by example the following format: ?myVariable=2017-01-10.

Cheers

Comments

Submitted by whramirez on Wed, 08/23/2017 - 14:29

Hello Lionel,
I've seen your response and following it and taking searchDemo example I'm trying adapting it with a datepicker and modifing the URL of API like something as:
«../API/bdm/businessData/com.company.model.MyBusinessObject?q=ByDate&p=0&c=10&f=myDate=%25{{dateIn}}%25». ByDate is my custom query in BDM with myDate in where condition and dateIn is a content of datepicker.
It's not working perhaps because my date field is date? (not localdate). Something wrong in URL?
Regards.

Submitted by whramirez on Wed, 08/23/2017 - 15:25

Hi,
I've found the response finally. My URL must be:
«../API/bdm/businessData/com.company.model.MyBusinessObject?q=ByDate&p=0&c=10&f=myDate={{dateIn|uiDate:'yyyy-MM-dd'}}». And it works!!
Thanks and regards.

Notifications