Reporting data source

I have a dynamic query that I want to pass to the report builder, similar to a parameter but the complete query.
What is the best way to achieve this, if it is possible.?
I can put the query in a client tag, as well as the returned data from this query in another client tag, but cannot get them to display data in the report designer.

What version are you on? For 7.8+, reports are executed on the gateway. This means you can’t use client tags unless you bind them to parameters in a Vision report viewer component or pass them in to a system.report scripting call.

Are you trying to pass the text of the query and have the report run that, or are you trying to pass the results of your query?

7.8.5
I am trying to do either…
My preference is to print the report rather than the data on the table component, as for this application it as a more professional presentation when done that way, rather than a screen shot.
I have tried binding client tags to parameters etc, & can get it to work with a straight parameter substitution, but with the current layout & filters, passing the entire query test would be preferred

Okay, I’ll assume that you have the query text in a client tag and are using system.report.executeAndDistribute() in the client to print the completed report. Remember, of course, that passing in the plain text of a query always carries some risk.

  1. Make a parameter for the query text. You’ll override the value of this parameter when you call system.report.executeAndDistribute(), giving it the value of your client tag
  2. Below the parameter for the query text, made a dataset parameter that uses runScript(‘system.db.runQuery()’). You’ll use your query parameter for the text of the query in the runQuery call, and give it the name of your datasource. (If the name also needs to be dynamic, make that a parameter that you override as well.) Any report parameter has access to the results of parameters above it.
  3. Use that dataset parameter in your report.

Yes, have the query text in a client tag.
Was not using the ‘system.report.executeAndDistribute()’ (was not even aware of it…)

Have been trying to create the report & dynamic data source within the report builder, so I can view layout etc.

So perhaps I need to take a step back, can the results of a dynamic datasource (query text or datasource) be viewed in the report builder?
Saying that, when I embed the report with the query text visible, still don’t get any data

You’d still need to follow steps 1-3 above, even if you’re embedding the report in a vision window.