SSRS 2008 use several iif statements together

  • In an existing SSRS 2008 r2 report, I have the following "IIF(RowNumber(Nothing) Mod 2 = 0, "Gainsboro", "White")" for the background color for every other detail line row.

    Basically one detail line is white and the next detail line is a light green color.

    Now the user wants every other detail line to remain white and light green color when displayed on the report server. However when the report is to be exported to excel,

    the user wants all lines exported to excel to be completely white.

    Here are the steps the user will complete:

    The user will select ‘Hide’ from the ‘Excel Export_Hide Headers’ dropdown list.

    The user will next select the view button prior to exporting the report to excel.

    The user will then select the export to excel option.

    **The user is basiscally going to hide the header rows when the report is suppose to be exported to excel.

    .

    When the header rows are are being hidden, the following logic is being used: "iif(Parameters!ExcelToolbar.Value = 0,false,true)".

    Thus can you tell me how to tie the "iif(Parameters!ExcelToolbar.Value = 0,false,true)", with the "IIF(RowNumber(Nothing) Mod 2 = 0, "Gainsboro", "White")" statement?

    Would this be nested iif statements? If so, can you tell show me how to setup the applicable nested iif statements? If this is not the solution, would you show me in code, explain to me, and/or point me to a url that will solve my problem?

  • You can nest IIf ie

    =IIf(Parameters!ExcelToolbar.Value = 0,IIf(RowNumber(Nothing) Mod 2 = 0, "Gainsboro", "White"), "White")

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Thanks!

  • I've used this in the past for hiding/showing extra columns in the import. This will make the columns white for all exports.

    =IIF(Globals!RenderFormat.Name="RDL",IIf(RowNumber(Nothing) Mod 2 = 0, "Gainsboro", "White"), "White")

    I haven't tested this with background colours, I was using it in the Tablix visibilty. I'm going to give it a try right now.

  • I should have tested it first...

    =IIF(Globals!RenderFormat.Name="EXCEL","White", IIf(RowNumber(Nothing) Mod 2 = 0, "Gainsboro", "White"))

    I had to reverse the TRUE/False part and the render report format type, but this should work.

  • Steven.Howes (11/22/2013)


    I should have tested it first...

    =IIF(Globals!RenderFormat.Name="EXCEL","White", IIf(RowNumber(Nothing) Mod 2 = 0, "Gainsboro", "White"))

    I had to reverse the TRUE/False part and the render report format type, but this should work.

    Nice 😀

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 6 posts - 1 through 5 (of 5 total)

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