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)
Help w/ BeforeOpen query
al91206
Hi,
I'm trying to switch sql statements depending on who is logged in. I can grab the username already, but switching the sql statement is beyond me.
What I'd like to do is:
If username is in (select user from users where int_user = 'Y')
then use (sql statement one)
else use (sql statement two)
I have the username setup as a variable already:
usr=serverusername
Any help is really appreciated.
Thanks,
Al
Find more posts tagged with
Comments
bhanley
You can access the query in the beforeOpen script using this syntax:
this.queryText = "some new query";
Good Luck!
al91206
The problem which I should have stated in my first post is in the IF part of the statement.
Can I use something like this:
if (usr in (select username from users where internal_users = 'Y'){
then this.queryText = "sql statement one"
}
else { sql statement two}
When I use that I get the generic syntax error.
mwilliams
Al,
I think you'll have to know whether usr is 'Y' in internal users coming in to the script to use a statement like this. Then you could do:
if (internal_user = "Y"){
this.queryText = "query1";
}
else{
this.queryText = "query2";
}
al91206
Don't know why I didn't think of that sooner. This works:
if (BirtStr.left(usr,4) == 'INT_'){
this.queryText = "query one"
}
Not the prettiest solution, but it works. If I knew how to access the security role in iServer Express I would be able to use that instead of username which would make all the difference.
Thanks for this though.
Al
mwilliams
Al,
Glad to help. If I figure out anything on the iSx, security role thing, I'll let you know.