Thursday, March 29, 2012
Credentials for Reports and Subscriptions
â'domain\userâ' value to pass to my dataset parameter. From there, I need to
create data-driven subscription with the same report.
* If I use User!UserID to pass to the data source parameter, RS will not
allow subscriptions to be created
* If I use any kind of data source that does not have the user and pass
stored, RS will not allow you to create a data driven subscription. Why
wonâ't the data driven subscription simply allow me to choose another data
source that does have stored credentials?
Is there any way around these limitations?
Best regards,
Joel Blackthorne
Hewlett-Packard CompanyJoel,
The RS Windows Service (ReportServerService.exe) runs subscriptions in an
unattended mode so there is no interactive user. If RS would have allowed
you to be able to use User!Userid you would get the Windows identity of the
account the RS Windows Service runs under (not very useful as you would
probably agree).
--
Hope this helps.
---
Teo Lachev, MVP [SQL Server], MCSD, MCT
Author: "Microsoft Reporting Services in Action"
Publisher website: http://www.manning.com/lachev
Buy it from Amazon.com: http://shrinkster.com/eq
Home page and blog: http://www.prologika.com/
---
"Joel" <Joel@.discussions.microsoft.com> wrote in message
news:FEFD3781-0374-42EA-B7FD-D83D207A308C@.microsoft.com...
> I have run into a seemingly impossible wall with RS. I need to have the
> 'domain\user' value to pass to my dataset parameter. From there, I need
to
> create data-driven subscription with the same report.
> * If I use User!UserID to pass to the data source parameter, RS will not
> allow subscriptions to be created
> * If I use any kind of data source that does not have the user and pass
> stored, RS will not allow you to create a data driven subscription. Why
> won't the data driven subscription simply allow me to choose another data
> source that does have stored credentials?
> Is there any way around these limitations?
> Best regards,
> Joel Blackthorne
> Hewlett-Packard Company|||the enterprise edition allow you to schedule a report for a bulk usage.
You have to create a query on a database to retreive the username, email,
paramaters values of your report parameter... (query NOT in the report, but
prepared by the administrator in the schedule definition)
when the schedule is reached, RS execute the query to retreive the user
names and send this name through a CUSTOM parameter (not the userid
parameter) and then RS render the report and email it.
another way is to create your own tool which produce the report in behalf of
a user, but you must store the user password anywhere!
then when you call the Report server service, you'll use this login name as
a credential instead-of the system user (or any other static account)
"Joel" <Joel@.discussions.microsoft.com> a écrit dans le message de news:
FEFD3781-0374-42EA-B7FD-D83D207A308C@.microsoft.com...
>I have run into a seemingly impossible wall with RS. I need to have the
> 'domain\user' value to pass to my dataset parameter. From there, I need
> to
> create data-driven subscription with the same report.
> * If I use User!UserID to pass to the data source parameter, RS will not
> allow subscriptions to be created
> * If I use any kind of data source that does not have the user and pass
> stored, RS will not allow you to create a data driven subscription. Why
> won't the data driven subscription simply allow me to choose another data
> source that does have stored credentials?
> Is there any way around these limitations?
> Best regards,
> Joel Blackthorne
> Hewlett-Packard Company|||Thanks for the feedback. However, in my opinion, User!UserID should return
the user id of the credentials that created the subscription then. At the
very least, Data-Driven subscriptions should let you handle this invalid
User!UserID condition by replacing it. As it stands, I donâ't see any way to
implement data-level security with RS if subscriptions are used. Can any one
suggest a way to achieve the goal outlined in the original post?|||Don't forget that there is always a back door leading to the .NET world.
Drop a pinch of custom code in your report, stir with some external .net
assemblies and escape the boundaries of the Report Server forever and ever.
--
Hope this helps.
---
Teo Lachev, MVP [SQL Server], MCSD, MCT
Author: "Microsoft Reporting Services in Action"
Publisher website: http://www.manning.com/lachev
Buy it from Amazon.com: http://shrinkster.com/eq
Home page and blog: http://www.prologika.com/
---
"Joel" <Joel@.discussions.microsoft.com> wrote in message
news:4607E1F7-EA33-4E0A-9A2B-9B48B4E5CE8C@.microsoft.com...
> Thanks for the feedback. However, in my opinion, User!UserID should
return
> the user id of the credentials that created the subscription then. At the
> very least, Data-Driven subscriptions should let you handle this invalid
> User!UserID condition by replacing it. As it stands, I don't see any way
to
> implement data-level security with RS if subscriptions are used. Can any
one
> suggest a way to achieve the goal outlined in the original post?
Tuesday, March 20, 2012
Creating table using dynamic SQL
I have the following dataset using dynamic SQL which works when i execute it, when i try to create a table using this dataset i cant see any fields. Does anyone know why dynamic SQL doesnt work ?
Declare @.TopRange int
Declare @.BottomRange int
Declare @.SQL Varchar(1000)
IF @.Param_leadage = '91+'
SET @.TopRange = 91
ELSE
Set @.TopRange = RTRIM(LEFT(REPLACE(@.Param_leadage,'-',''),2))
IF @.Param_leadage = '91+'
SET @.BottomRange = 4000
ELSE
Set @.BottomRange = LTRIM(RIGHT(REPLACE(@.Param_leadage,'-',''),2))
SET @.SQL = 'SELECT dbo.tblCustomer.idStatus, dbo.tblCustomer.idCustomer, dbo.tblCustomer.DateSigned' +
' FROM dbo.tblCustomer' +
' WHERE DateDiff(day, dbo.tblCustomer.DateSigned, GetDate()) >= ' + convert(varchar,@.TopRange) + ' AND DateDiff(day,dbo.tblCustomer.DateSigned, GetDate()) <= ' + convert(varchar,@.BottomRange)
IF @.Param_status = 'Online Churn'
SET @.SQL = @.SQL + ' AND dbo.tblCustomer.idStatus = 4 or dbo.tblCustomer.idStatus = 5 or dbo.tblCustomer.idStatus = 11'
ELSE
SET @.SQL = @.SQL + ' AND dbo.tblCustomer.idStatus = ' + @.Param_idstatus
EXEC(@.SQL)
If the Refresh Fields toolbar button enabled on the Data tab is enabled, try clicking it to get the fields. Or, plug in only the SELECT statement and hit Refresh Fields to get the fields.Then, change it to the original SQL. Finally, you can create the dataset fields manually.
|||Hi Teo,
This isnt working, when i try to select a data field from the table textbox properties value dropdown box, it says 'Dataset1 has no fields'
When I enter it in manually it gives an error which is obviously to do with the fields not being in the scope.
In the Data screen within VSS 2005 the sql executes fine, when i refresh it prompts for parameters off which i enter and the data is returned, it is not recognising any fields when i try to access any fields from any controls..
it has something to do with the exec(sql) command and dynamic data i would suspect
I also tried doing the SQL first off which the table fields are recognised but as soon as i add the other portions such as the single quotes etc it gives the same error
Can someone please help
thanks
|||
Try putting this code in a stored proc and changing the command type to be stored proc.
The other option is to not use dynamic SQL, instead use an expression based query and construct the SQL using expression syntax e.g.
= Iif(Parameters!x.value = "91+", "Select...", "select ...")
Again, in this case I follow the previous advice of just putting in the SQL query first, hitting refresh so RS auto-generates the Filed definitions and then swapping in the expression
|||@. is interpreted as a query parameter in the Query Designer. You can make the whole darn thing expression-based as Adam suggested or move this query to a stored procedure.
|||
thanks guys, i put it in a stored proc and it is working now
Sunday, February 19, 2012
Creating Grand Totals
query, Was wondering how do I create Grand Totals for the 'Total Revenue'and
Ã?nits Sold columns on my report, thanks
Charlie
SELECT tblProduct.Name, Count(tblProduct.Name) AS 'Units Sold',
Sum(tblProduct.VOSValue) AS 'Total Revenue',tblProduct.PCMSCode,
tblProductCategory.Name As 'Product Category'
FROM (tblProduct INNER JOIN tblCustomerProduct ON tblProduct.idProduct = tblCustomerProduct.idProduct) LEFT JOIN tblProductCategory ON
tblProduct.idProductCategory = tblProductCategory.idProductCategory
GROUP BY tblProduct.Name, tblProduct.PCMSCode, tblCustomerProduct.idProduct,
tblCustomerProduct.idProductActivity,
tblCustomerProduct.idProductRemovalReason, tblProduct.NonSaleProduct,
tblCustomerProduct.idProductDesignation, tblProductCategory.Name
HAVING (((tblCustomerProduct.idProductActivity)=1) AND
((tblCustomerProduct.idProductRemovalReason) Is Null) AND
((tblProduct.NonSaleProduct)=0) AND
((tblCustomerProduct.idProductDesignation)=1))
ORDER BY tblProduct.NameCharlie:
Just drag and drop the appropriate fields from the Fields (SSRS2000)
or Datasets pane (SSRS2005) into the table footer. SSRS will add the
SUM aggregate for you.
HTH
toolman
Charlie wrote:
> Ive got a basic tabular report using a dataset built from the following
> query, Was wondering how do I create Grand Totals for the 'Total Revenue'=and
> =DAnits Sold columns on my report, thanks
> Charlie
> SELECT tblProduct.Name, Count(tblProduct.Name) AS 'Units Sold',
> Sum(tblProduct.VOSValue) AS 'Total Revenue',tblProduct.PCMSCode,
> tblProductCategory.Name As 'Product Category'
> FROM (tblProduct INNER JOIN tblCustomerProduct ON tblProduct.idProduct ==3D
> tblCustomerProduct.idProduct) LEFT JOIN tblProductCategory ON
> tblProduct.idProductCategory =3D tblProductCategory.idProductCategory
> GROUP BY tblProduct.Name, tblProduct.PCMSCode, tblCustomerProduct.idProdu=ct,
> tblCustomerProduct.idProductActivity,
> tblCustomerProduct.idProductRemovalReason, tblProduct.NonSaleProduct,
> tblCustomerProduct.idProductDesignation, tblProductCategory.Name
> HAVING (((tblCustomerProduct.idProductActivity)=3D1) AND
> ((tblCustomerProduct.idProductRemovalReason) Is Null) AND
> ((tblProduct.NonSaleProduct)=3D0) AND
> ((tblCustomerProduct.idProductDesignation)=3D1))
> ORDER BY tblProduct.Name