Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Parameterize From clause of SQL statement
lgudait
Is it possible to parameterize the from clause of a SQL statement?
For example:
Select *
from ?
I'm getting an error if I try to use the ? in the FROM clause. Any other ideas?
Find more posts tagged with
Comments
mwilliams
You can write your query in your beforeOpen script and bypass the use of the dataSet parameter.
lgudait
Sorry, I'm terrible at using the different methods, and pretty JavaScript illiterate. Could you provide a simple example in classic models?
mwilliams
You would just need to do something like:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
this.queryText = "select * from " + params["myparameter"];
</pre>
mwilliams
I can make an example still, if you want. Just let me know your BIRT version.
lgudait
I'll try it out, see if I can get it to work.
Another question - would this cause any performance issues running my report this way (as in, will it run slower with the sql in the beforeOpen)? Users are directly hitting our SQL datamarts (rather than smaller data objects we used for other reports) so these reports are already a bit slower to start with.
mwilliams
No, it shouldn't be any slower than writing the query in the editor.
lgudait
I got a basic sample to work in classic models - hopefully it will work applied to my much more complicated dataset.
Thanks again for the help!