@Julie Bolinsky and @Stephen Canzano
Thanks for your replies!
To back up and offer more clarity: the issue was that the WHERE clause of our query used a stored procedure to calculate a data element. This was causing the query to churn and for the Zen reports to timeout. We wanted to break the query apart so that it could select a subset of the data by date range first and then loop through that data and run the store proc only that data to filter it further. A subquery didn't end up being any more efficient here. Views and CREATE TABLE ... AS wouldn't work at scale. Since Zen wants a %Library.ResultSet object, I researched fetching each record and deleting data as needed OR creating a new %Library.ResultSet object and adding data to that, but there are no methods to support that.
The question was: can you give a Zen report a dynamic object as a data source?
Sounds like the answer is only %Library.ResultSet or XML file (or stream). The stream idea is ok, but it's a big report and it would have been a big lift to transform the %Library.ResultSet into XML.
The solution was 1) move the stored proc out of the WHERE clause and into the SELECT and 2) use the filter='%val(""DataElement"")=VALUE' in the report tag to evaluate the table alias created by the stored proc in the select to skip the rows we didn't want to generate PDFs for.
Happy to talk more about this as I'm sure I'll be touching some Zen stuff again.
- Log in to post comments
.png)
.png)
.png)