Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
database as a parameter?
al91206
Hi,
We have an environment where each customer is in a separate database:
Cust_1DB
Cust_2DB
etc
My query looks like:
Select *
from Cust1DB:Table
I want to substitute Cust1DB for a user selected parameter - is this possible - has anyone had to do this?
Any help or info is appreciated.
Thanks!
Al
Find more posts tagged with
Comments
mwilliams
Hi Al,
You can change the query in the beforeOpen script of your dataSet with the following script:
this.queryText = "select blah from blah";
So, you could use a parameter value to select which table you select your values from. Let me know if you have any questions.
al91206
Thanks for the quick reply - I am at the Data Set script area.
In the BeforeOpen scripting area I have:
this.queryText = "Select * from ?:table"
Is this where I'm supposed to put the ? to initiate a parameter? It doesn't seem like the correct format.
bhanley
You are close. Try this:
this.queryText = "Select * from " + params["table_param"]
This should build out your query and point it to the right table each time the report executes.
al91206
Thanks for the help - it worked and just for those who don't know - you need to have a report parameter as well.
I guess that's obvious, but just an fyi to anyone doing this for the first time.