Dynamically name report/file export in SSRS

  • Jason Selburg

    SSC-Insane

    Points: 24560

    Comments posted to this topic are about the item Dynamically name report/file export in SSRS

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • meiscooldude

    SSC Enthusiast

    Points: 109

    I've been trying to figure out how to do this at work for ages!

    Thanks a ton for the tip!

  • jezman

    SSChasing Mays

    Points: 611

    I haven't done it myself, but I guess you could also dynamically configure the name if executing reports with rs.exe

  • Gaurav.Vinodkumar

    SSC Veteran

    Points: 222

    nice article...but one question..if we have to do the same thing at run time (means when user export the rport to pdf or excel) from the report viewer..is there any way to do this?

  • l543123

    SSC Eights!

    Points: 934

    nice tip.. I have played around updating the subscriptions table also.. because we needed to email the same report to 70 users, by just changing one user parameter on the report. I dint want to crate 70 subscriptions, so created 1 email subscriotion which created a record in subscriptions table and also a agent job.

    1) created a table to store the 70 userid & email

    2) Then wrote a SP to loop and update the parameters & extensionsettings fields in the subscription table

    3) Kick off the subscription using below statement after each update

    ReportServer.dbo.AddEvent @EventType='TimedSubscription', @EventData='asdasd-12sad-dsfas-dzfad-dfasdfsdfsd'

    4) Wait a minute using "Waitfor Delay"

    5) Updated the Agent job, commented the "ReportServer.dbo.AddEvent" in the job step and called the SP in that step.

    So now the subscription throws an error when you try to edit from Report Manager, which is good because if somebody edits it, SSRS will update existing job with the addevent step. This works fine because if later I need to change email or add new users, I just need to add a record to the table.

    Do you know of any other better way to do this??

  • Jason Selburg

    SSC-Insane

    Points: 24560

    Gaurav.Vinodkumar (3/22/2010)


    nice article...but one question..if we have to do the same thing at run time (means when user export the rport to pdf or excel) from the report viewer..is there any way to do this?

    Not that I know of.. 🙁

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • SQLRNNR

    SSC Guru

    Points: 281210

    Nice article.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • SQL-Student

    SSC Eights!

    Points: 808

    What about customer support?

    From what I know, Microsoft will not support you, if you make modifications to the SSRS Catalog manually.

  • Jason Selburg

    SSC-Insane

    Points: 24560

    SQL-Student (3/22/2010)


    What about customer support?

    From what I know, Microsoft will not support you, if you make modifications to the SSRS Catalog manually.

    *grin* Don't tell them

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • josh.fraser

    SSC Journeyman

    Points: 83

    Jason,

    Did you know that in the subscription you could just set the filename to

    @ReportName@ParameterName and it will save the report ?

  • Miles Neale

    SSChampion

    Points: 13147

    Hi Jason,

    First of all what you have done is interesting and will work and very creative. Job well done.

    There is however an alternative available that you might want to explore if you are interested in delivery extensions and know something about c#.

    You can write a custom delivery extension that manages the name anyway you please, and will also do whatever else you want. I have written a collection of extensions and once you understand the simple approach to code and figure out the configuration for the extensions in the report manager and report server it is a very useful approach to getting out of SSRS what you want.

    Also if you are working in code you can attach to the SSRS web services and render the report of your choice and send or put it where you want. Again not a difficult process and there are examples in various places. I have found this ability interesting when you want to send a report out to someone and keep a copy in a repository.

    Again what you are doing is great. There are other options available if you want to go there.:-)

    Not all gray hairs are Dinosaurs!

  • Jason Selburg

    SSC-Insane

    Points: 24560

    Miles Neale (3/31/2010)


    Hi Jason,

    First of all what you have done is interesting and will work and very creative. Job well done.

    There is however an alternative available that you might want to explore if you are interested in delivery extensions and know something about c#.

    You can write a custom delivery extension that manages the name anyway you please, and will also do whatever else you want. I have written a collection of extensions and once you understand the simple approach to code and figure out the configuration for the extensions in the report manager and report server it is a very useful approach to getting out of SSRS what you want.

    Also if you are working in code you can attach to the SSRS web services and render the report of your choice and send or put it where you want. Again not a difficult process and there are examples in various places. I have found this ability interesting when you want to send a report out to someone and keep a copy in a repository.

    Again what you are doing is great. There are other options available if you want to go there.:-)

    Thanks Miles I appreciate the comment, and I'm sure others will get some info on the C# method from it.

    As always though, my intent is to only show "another" way of getting a task completed. I try not to presume that my method is best!

    ... and seriously, I appreciate the comment.

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • slmcweidman

    Valued Member

    Points: 65

    How exactly? When I change the filename in the subscription to Scorecard@Date, or even @ReportName@Date (@Date is a parameter) I get that name as the report name "@ReportName@Date" or "Scorecard@Date".

  • gcbohmann

    SSC Enthusiast

    Points: 123

    Has anyone else had success with this method? I always receive an Item not found error when the subscription runs if the path is altered in anyway on SSRS 2008.

  • Stefan K

    SSCommitted

    Points: 1786

    Hi, I have this problem, too.

    Changing the content in Reportserver Database does not seem to be a feasible solution to me. I do not want to think of what could happen if the subscription execution fails for any reason.

    If I understood it correctly, this solution will also only work if you want to set the reportname only once per execution of the subscription (and then back to origin).

    If you want to set it for every entry in the data driven subscription source query you will have to change the data during the execution of the subscription, which would be only possible using a stored proc as dummy datasource which does this any time the report is executed...

    @josh - There is no filename attribute which you could define in an email subscription.


    Kindest Regards,

    SK

Viewing 15 posts - 1 through 15 (of 22 total)

You must be logged in to reply to this topic. Login to reply