Indicia-Team / warehouse

GNU General Public License v3.0
5 stars 3 forks source link

Filtering reports by custom attributes #207

Open dve opened 8 years ago

dve commented 8 years ago

I've a report where I add custom sample attributes by the smpattrs paramter by id, eg. 10. But I also want to filter by this parameter so I also add attr_sample_10 whit a value eg. Test. But this filter is ignored by the report. Do I have to do something different or is this not supported?

If its not supported, I ask for implementing it.

Best regards

Daniel

johnvanbreda commented 8 years ago

Hi Daniel, I've just tried this myself. In my case I have an integer attribute ID 18. I set attr_sample_18=1 and this correctly filters the report. So it should indeed work as you expect. The code to add the filter is on line 800 of application/libraries/ReportEngine.php.

dve commented 8 years ago

Ok, it also works here - don't know why it didn't. Another question: is it possible to use another operator for custom attributes? Like all surveys where the attribute 7 is less then 200?

johnvanbreda commented 7 years ago

No, that's not currently possible, though rather than relying on the automatic addition of custom attribute columns to reports you could create a report for specific custom attribute columns with the columns built into the SQL. You can then parameterise the operator as you like.