Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSRS 2008 R2 Globals!RenderFormat export methods

There are 7 built in options for exporting SSRS 2008 reports.

I was wondering if there is an easier way to code the following in SSRS when chosing the export option:

=IIF(Globals!RenderFormat.Name="WORD" OR Globals!RenderFormat.Name="XML" OR  
  Globals!RenderFormat.Name="CSV" OR Globals!RenderFormat.Name="TIFF" OR   
  Globals!RenderFormat.Name="PDF", Globals!RenderFormat.Name="MHTML" OR 
  Globals!RenderFormat.Name="EXCEL",true,false)

Is there a way to write the code above without having to list each export option listed? A way that includes all the export options? If so, how would you write that code?

like image 461
user1816979 Avatar asked Dec 05 '22 08:12

user1816979


2 Answers

The suggestion from ShellNinja won't work as a visibility expression because of the order in which expressions and other report items are processed and rendered.

The article Built-in Globals and Users References on TechNet hints at this (allbeit a very vague hint) under the RenderFormat subheading where it says that:

Globals!RenderFormat.Name is available during specific parts of the report processing/rendering cycle.

Globals!RenderFormat.Name is not populated prior to expressions being evaluated, it's populated on completion of the current render request which is why it can't be used in a visibility expression but will display the name in a textbox.

Globals!RenderFormat.IsInteractive is populated prior to expression evaluation and is the only way of hiding/showing a report item prior to a report being rendered. RPL and HTML are considered fully interactive formats, all other formats are not or only support some interactive features. More information on this can be found in the article Comparing Interactive Functionality for Different Report Rendering Extensions on TechNet.

like image 101
Jonathon Ogden Avatar answered Dec 06 '22 20:12

Jonathon Ogden


Use "RPL" for a simpler IIF expression so that any other format is "EXCEL", "CSV", "WORD", etc. When the report is displayed in the report server viewer or a ReportViewer control the RenderFormat is "RPL".

    =IIF(Globals!RenderFormat.Name = "RPL", true, false)

The above code when set as a visibility expression will show the field when rendered in SSRS and hide it on export.

Tip: When you have a long IIF expression use a switch expression Reporting Services Expression Examples they are by far cleaner and easier to manage.

like image 24
ShellNinja Avatar answered Dec 06 '22 20:12

ShellNinja