rossi_jeff Posted February 8, 2011 Share Posted February 8, 2011 I'm trying to repoduce in a report results from my application. The app send the following params$P{include} = false$P{start_time} = '17:00:00'$P{end_time} = '22:00:00' In my report I added this parameter$P{daily_clause}default value:new String(($P{include} == true) ? "" : " AND (TIME(readings.`created_at`)>'" + $P{start_time}.toString() + "' OR TIME(readings.`created_at`)<'" + $P{end_time}.toString() + "')") And my querySELECT readings.`id` AS readings_id, readings.`speed` AS readings_speed, readings.`device_id` AS readings_device_id, readings.`created_at` AS readings_created_at, readings.`event_type` AS readings_event_type, readings.`street_number` AS readings_street_number, readings.`street` AS readings_street, readings.`place_name` AS readings_place_name, readings.`admin_name1` AS readings_admin_name1, devices.`id` AS devices_id, devices.`name` AS devices_nameFROM `readings` readings INNER JOIN `devices` devices ON readings.`device_id` = devices.`id`WHERE readings.`device_id` = $P{device_id} AND readings.`created_at` BETWEEN $P{start_date} AND $P{end_date} $P!{daily_clause} I printed ${daily_clase} in a cell and it looks correct but has no effect on the query. Link to comment Share on other sites More sharing options...
rossi_jeff Posted February 8, 2011 Author Share Posted February 8, 2011 My Bad OR should be AND in $P{daily_clause} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now