all groups > sql server reporting services > december 2005 >
You're in the

sql server reporting services

group:

Named Query and Global Variables


Named Query and Global Variables WillG
12/12/2005 10:11:01 PM
sql server reporting services:
Hello,
I want to filter records right in the Data Source View.
I did a "Replace Table with new Named Query" but how can I get it to filter
records by User!UserID?

Thanks,
-Will

Re: Named Query and Global Variables sorcerdon NO[at]SPAM gmail.com
12/13/2005 6:19:19 AM
"I want to filter records right in the Data Source View."

What do you mean by this?

you want to filter your DATA? or do you want to set different
permissions for different users?
Re: Named Query and Global Variables WillG
12/13/2005 7:02:03 AM
I want to filter my data.
So "select * from table where field1=user!userid"


[quoted text, click to view]
Re: Named Query and Global Variables Bruce L-C [MVP]
12/13/2005 9:37:59 AM
Query parameters do not have to map to report parameters. RS automatically
creates a report parameter for every query parameter but you can delete them
and use an expression.

So, do this:

select * from mytable where field1 = @User

RS will create automatically a report parameter called User. Instead of
using this mapping, you want to change it.

Click on the ... in the dataset designer, go to the parameters tab. On the
right side change from using a report parameter to using an expression. This
will bring you to the expression builder where you can set it to =
User!UserID

Now, in the layout tab, report parameters menu, delete the report parameter
which was created for you.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

Re: Named Query and Global Variables WillG
12/13/2005 1:59:02 PM
I'm trying to use report models though.
So f I follow the example from msdn here:
http://msdn2.microsoft.com/en-us/library/ms156284.aspx

So after I create "Data Source View" I click on a Product table and click
replace with a named query, this let's me edit the sql or use the query
builder to filter records. In the "Filer" column for a field called user_id I
put =User!UserID, hoping that only products that user_id = User!UserId will
be returned. It does not like that filter, in fact I see nothing about global
variables or variables at all.

**The above is the way I'd like to do my filtering, but if not then:
I tried filtering in the "Report Model":
Looked at the fields, click "Add Group" and All must contain
dragged the user_id field into that "All must contain" box and set it to
user_id must contain GetUserID()
Not sure about the exact area's I clicked because I'm not by my development
pc. But I could not get the Report Model to Filter either.

I like the DataSource View filter because it's a universal way for anyone
who creates reports, in reportbuilder or dev. studio, to only have access to
records that have their userid.
-Will



..

[quoted text, click to view]
Re: Named Query and Global Variables Bruce L-C [MVP]
12/13/2005 10:38:35 PM
Sorry, I don't have any experience with report models. Can't help you.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

AddThis Social Bookmark Button