There is not enough information in the documentation about
overriding sub-report queries using functions. I can not figure out
how the function call is to be passed.
Here is the page and quote from the livedocs:
---
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_r-s_07.html
"Note: You cannot specify a subreport query that depends on arguments from the master report. Instead, you can define a CFML function or CFC method that returns the subreport query given the arguments from the master report. ColdFusion calls this code when it executes the subreport."
---
If I send over just the function call as a string it throws an error that it must be a query. If I evaluate it with # then it appears to make the call once before creating the report and uses the same query for the sub-report for every single master report record.
My example report is simple. Retrieve a query of contacts records. The contact records have a state field which is the parameter for the sub-report. The sub-report performs a query and presents related information.
I am trying to optimize this by pre-processing the queries for each state into memory, then pass a function that is to be used to get the correct sub-report query from memory.
I have tried all variations that I can think of with no success. If I try to pass variables to the function that exist in the report, such as query and param, errors are thrown. I can only access variables already created earlier in my code which makes me think that the function is being evaluated once in the cfqueryparam tag. I can not find a way to delay evaluation so that it is evaluated for each call to the sub-report instead.
Here is the page and quote from the livedocs:
---
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_r-s_07.html
"Note: You cannot specify a subreport query that depends on arguments from the master report. Instead, you can define a CFML function or CFC method that returns the subreport query given the arguments from the master report. ColdFusion calls this code when it executes the subreport."
---
If I send over just the function call as a string it throws an error that it must be a query. If I evaluate it with # then it appears to make the call once before creating the report and uses the same query for the sub-report for every single master report record.
My example report is simple. Retrieve a query of contacts records. The contact records have a state field which is the parameter for the sub-report. The sub-report performs a query and presents related information.
I am trying to optimize this by pre-processing the queries for each state into memory, then pass a function that is to be used to get the correct sub-report query from memory.
I have tried all variations that I can think of with no success. If I try to pass variables to the function that exist in the report, such as query and param, errors are thrown. I can only access variables already created earlier in my code which makes me think that the function is being evaluated once in the cfqueryparam tag. I can not find a way to delay evaluation so that it is evaluated for each call to the sub-report instead.