Report builder: Insert value from a listbox

4 posts by 3 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: July 4, 2019   (RSS)

By Toledoh - June 30, 2019

I have a similar question, I'd like to be able to build a simple form that identifies the WHERE aspect of the report.

Where Andreas is wanting to add a WHERE hospital = $variable, I'd like to be able to choose a date range, or similar.

I notice in the plugin there's commented PHP with " // parse form input" - is this something that can be extended in the plugin? 

Cheers,

Tim (toledoh.com.au)

By Dave - July 4, 2019

Hi Andreas (and Tim), 

There's no built-in search functionality in Report Builder but you can use PHP code in the queries.  So with this query: 

SELECT surname, name
FROM `<?php echo $TABLE_PREFIX ?>aortic_aneurysm_disease`
WHERE hospital='Athens Hospital'
LIMIT 1000

You could do this (untested code) to get there WHERE value from the request: 

SELECT surname, name, hospital
FROM `<?php echo $TABLE_PREFIX ?>aortic_aneurysm_disease`
<?php if (isset($_REQUEST['hospital'])) { echo mysql_escapef(" WHERE hospital = ? ", $hospital); } ?>
LIMIT 1000

And then you could specify the hospital in the url like this: &hospital=Athens+Hospital

You'd still need to modify the plugin or add some custom code or links to generate those links though.

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

By Dave - July 4, 2019

And just noticed, you can also use HTML and PHP in the Description field.  So you could have a list of hospital links there or try adding a pulldown.  

Dave Edis - Senior Developer
interactivetools.com