Thursday, March 22, 2012

data driven subscription & User id

I have a report that makes use of the global user id parameter. I was going
to set it up as a data driven subscription but as long as I have that
parameter in the report ... the option to schedule that report is not even
allowed. Why is that?Because who is the user when it is scheduled? The userid is the person
requesting the report to run. This makes no sense when scheduling.
The user id is not who is viewing it (which makes sense because you can use
the userid as a query parameter so you have to know who the user is prior to
retrieving the data).
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"MJT" <MJT@.discussions.microsoft.com> wrote in message
news:57010572-B007-473A-8892-113CD05F2CEF@.microsoft.com...
>I have a report that makes use of the global user id parameter. I was
>going
> to set it up as a data driven subscription but as long as I have that
> parameter in the report ... the option to schedule that report is not even
> allowed. Why is that?|||I know that makes sense ... I guess I should have completed my thought. This
report is needed to run both interactively and in a batch mode (which we are
using data driven subscriptions for). So the code that has the user_id parm
is mainly for interactive use. I was wondering if there might be a way to
avoid having to create 2 separate reports ... one for interactive and one for
batch. The interactive uses the user_id to force the initiation of the
report from a portal user interface (which puts an entry into a table when
initiated and contains user_id and what client user is running the report for
- this is handled by security code contained in the UI) That way if the url
is copied and pasted into a browser and someone else tries to run the report
... it will fail because there will not be an entry created by the UI to
match the user_id of the person running the report (unless it is the same
person who just ran it ;-) ) Anyway ... the desire to run this report in
a batch fashion came along later ... and it wont work for obvious reasons.
Is there an easy way to disregard the dataset that reads a table using the
user_id? It seems that just having that parameter in the report disagrees
with reporting services ... it doesnt care if there is logic to disregard it
. I'll have to give this some more thought ... but just wondering if you
have run into other situations where a report needed security for online ...
but wanted to disregard that for a batch run. Thanks,
"Bruce L-C [MVP]" wrote:
> Because who is the user when it is scheduled? The userid is the person
> requesting the report to run. This makes no sense when scheduling.
> The user id is not who is viewing it (which makes sense because you can use
> the userid as a query parameter so you have to know who the user is prior to
> retrieving the data).
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
>
> "MJT" <MJT@.discussions.microsoft.com> wrote in message
> news:57010572-B007-473A-8892-113CD05F2CEF@.microsoft.com...
> >I have a report that makes use of the global user id parameter. I was
> >going
> > to set it up as a data driven subscription but as long as I have that
> > parameter in the report ... the option to schedule that report is not even
> > allowed. Why is that?
>
>|||First off, you say it is a report param? User!UserID is a global variable.
Are you assigning it to a report parameter? You can use it without first
assigning it to a report parameter. I think if you use it as a query
parameter you will need to run a test and find out what value it has when
run as a subscription then use an expression that substitutes whatever makes
sense.
As a test do this: Create a report with no dataset. Just a textbox set to an
expression and the value of the expression set to
=User!UserID.Value
Run the report both interactively and as a subscription and see what you
get. Then wherever you need it use an expression and an if statement.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"MJT" <MJT@.discussions.microsoft.com> wrote in message
news:2921F680-9C88-4BD2-8165-717CE1909428@.microsoft.com...
>I know that makes sense ... I guess I should have completed my thought.
>This
> report is needed to run both interactively and in a batch mode (which we
> are
> using data driven subscriptions for). So the code that has the user_id
> parm
> is mainly for interactive use. I was wondering if there might be a way to
> avoid having to create 2 separate reports ... one for interactive and one
> for
> batch. The interactive uses the user_id to force the initiation of the
> report from a portal user interface (which puts an entry into a table when
> initiated and contains user_id and what client user is running the report
> for
> - this is handled by security code contained in the UI) That way if the
> url
> is copied and pasted into a browser and someone else tries to run the
> report
> ... it will fail because there will not be an entry created by the UI to
> match the user_id of the person running the report (unless it is the same
> person who just ran it ;-) ) Anyway ... the desire to run this report
> in
> a batch fashion came along later ... and it wont work for obvious reasons.
> Is there an easy way to disregard the dataset that reads a table using the
> user_id? It seems that just having that parameter in the report disagrees
> with reporting services ... it doesnt care if there is logic to disregard
> it
> . I'll have to give this some more thought ... but just wondering if you
> have run into other situations where a report needed security for online
> ...
> but wanted to disregard that for a batch run. Thanks,
> "Bruce L-C [MVP]" wrote:
>> Because who is the user when it is scheduled? The userid is the person
>> requesting the report to run. This makes no sense when scheduling.
>> The user id is not who is viewing it (which makes sense because you can
>> use
>> the userid as a query parameter so you have to know who the user is prior
>> to
>> retrieving the data).
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>>
>> "MJT" <MJT@.discussions.microsoft.com> wrote in message
>> news:57010572-B007-473A-8892-113CD05F2CEF@.microsoft.com...
>> >I have a report that makes use of the global user id parameter. I was
>> >going
>> > to set it up as a data driven subscription but as long as I have that
>> > parameter in the report ... the option to schedule that report is not
>> > even
>> > allowed. Why is that?
>>sql

No comments:

Post a Comment