简体   繁体   English

SSRS数据驱动的订阅电子邮件至:参数取决于报表参数?

[英]SSRS data driven subscription email to : parameter dependent on report parameter?

Hi I am using visual studio 2015 to make an SSRS 2014 report. 嗨,我正在使用Visual Studio 2015制作SSRS 2014报告。 The place I am stuck at is my email recipient is dependent on what company is selected from the SSRS report. 我停留在的位置是我的电子邮件收件人,这取决于从SSRS报告中选择的公司。

Not that it should matter but my report parameters are Company (really companyID),begdat,enddate. 没关系,但是我的报告参数是Company(实际上是companyID),begdat,enddate。

select email from users where companyid= @companyid<< which would be my selection.

Most examples I see have a defined list of emails or just 1 person to email. 我看到的大多数示例都有一个已定义的电子邮件列表,或者只有一个人可以发送电子邮件。 I want to send a report per company only to the users of that company aka dynamic recipient list. 我只想向每个公司(也称为动态收件人列表)的用户发送报告。

  1. Modify your query as: select email, companyid from users 将查询修改为: select email, companyid from users

  2. At the next step in select an option Get the value from the database for the TO field and set it to email . 在下一步中,选择一个选项: Get the value from the database获取TO字段的值,并将其设置为email

  3. At the next step change your company option to Get the value from the database and set it to companyid . 在下一步中,将您的公司选项更改为Get the value from the database并将其设置为companyid

Then users from company CompanyA will receive only a CompanyA report, and CompanyB - only a CompanyB report. 这样,公司CompanyA的用户将仅收到CompanyA报告,而CompanyB-仅收到CompanyB报告。

You could debug the subscription using temporary query with only your email: 您可以仅使用电子邮件使用临时查询来调试订阅:

select email='your@email', companyid = 'CompanyAid' UNION ALL select email='your@email', companyid = 'CompanyBid'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM