tommyfly
asked on
Clever data driven subscriptions
I haven't been able to find any information about this, but excuse me if someone else has already asked a similar question.
Using one report and one data driven subscription, I would like to send varying result sets to different groups of users based on a parameter.
I set up a query (see below) that returns a list of email addresses and then loops through based on the @suppgroup variable.
What I would then like to do is have reporting services send reports to the recipients with the relevant result sets based on the @suppgroup variable.
Currently, the subscription runs but does not loop through the @suppgroups table properly. It merely gets the first row and sends the report to that email address.
I guess the main question is if this is at all possible. Please let me know if more information would help.
Thanks
Using one report and one data driven subscription, I would like to send varying result sets to different groups of users based on a parameter.
I set up a query (see below) that returns a list of email addresses and then loops through based on the @suppgroup variable.
What I would then like to do is have reporting services send reports to the recipients with the relevant result sets based on the @suppgroup variable.
Currently, the subscription runs but does not loop through the @suppgroups table properly. It merely gets the first row and sends the report to that email address.
I guess the main question is if this is at all possible. Please let me know if more information would help.
Thanks
declare @suppgroup varchar(50)
declare @suppgroups table(suppnumber int PRIMARY KEY IDENTITY(1,1),suppgroup varchar(50))
insert into @suppgroups (suppgroup)
select distinct suppgroup from dbo.opencall
declare @suppgroupcount int
set @suppgroupcount = (select max(suppnumber) from @suppgroups)
DECLARE @counter int
set @counter = 1
while @counter <= @suppgroupcount
begin
set @suppgroup = (select suppgroup from @suppgroups where suppnumber = @counter)
select DISTINCT u.email,o.suppgroup from dbo.userdb as u
join dbo.opencall as o
on o.owner = u.keysearch
where o.suppgroup = @suppgroup
set @counter = @counter + 1
end
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The way we use it is to have a parameter for the report in the table above - 'ReportEdition'. We have ReportID column that is used to group recipients of a report - image below'. The column ReportEdition is a parameter to be sent to report, within the report the parameter is used to control what data is within report that is sent.
DDR.JPG
ddr-step-5.JPG
DDR.JPG
ddr-step-5.JPG
ASKER
Thanks everyone for all your help. I will now go and test some of the suggections and see what works.
ASKER
Thank you for your help. I now have a subscription running the way I wanted it.
ASKER
The report returns different results for each suppgroup. I already have a table (in my data source) that associates suppgroups and users with email addresses.
I guess what I'm confused by is what would the query referencing your table look like?
Thanks again.
Tom