← Back to team overview

dhis2-devs team mailing list archive

Issue with date varibales for Sql View of type allows for variables

 

Hi,

I have created a sample sql view which has 2 variable parameters namely
startDate and endDate. My sql view looks like:


*SELECT dv.* from datavalue dv inner join period p on dv.periodid =
p.periodid where p.periodtypeid = 8 and p.startdate >= '${startDate}' and
p.enddate <='${endDate}' limit 500;*

I am trying to pass these 2 date values from api url, but getting below
error message:

URI:
https://apps.dhis2.org/demo/api/sqlViews/Eod3B6ET3dw/data.json?var=startDate:2015-01-01&var=endDate:2015-03-31

Response:
{

   - httpStatus: "Conflict",
   - httpStatusCode: 409,
   - status: "ERROR",
   - message: "SQL query contains variables which were not supplied in
   request: [endDate, startDate]"

}

If I place these date values inside sqlview then I am able to get the
result.

Can you please help me to find where I am doing mistake. Thanks.




-- 

Regards,
Bharath Kumar. Ch

Follow ups