Results 1 to 2 of 2

Thread: [RESOLVED] SSRS IIF statement

  1. #1

    Thread Starter
    Frenzied Member zuperman's Avatar
    Join Date
    Dec 2000
    Location
    Portugal
    Posts
    1,033

    Resolved [RESOLVED] SSRS IIF statement

    Code:
    =IIF(Fields!tipo.Value=0, MonthName(right(Fields!mensalidadeId.Value,2)) & " " & int(left(Fields!mensalidadeId.Value,4)),int(left(Fields!mensalidadeId.Value,4)))
    I have this condition in a textbox inside the report

    • Fields!tipo.Value can assume 4 values: 0, 1, 2, 3
    • Fields!mensalidadeId.Value (this is year, or year and month concateneted) can assume values like 2012, 2013, 201212, 201301
    • When Fields!tipo.Value<>0 then Fields!mensalidadeId.Value is always 2012 or 2013



    The problem is that when Fields!tipo.Value<>0 and Fields!mensalidadeId.Value=2013 the result of the condition is an error (trying to calculate MonthName(13)).
    I assume even if the condition is false (ie Fields!tipo.Value<>0) IIF evaluates all arguments...

    Thx in advance...
    Regards
    Last edited by zuperman; Dec 28th, 2012 at 09:41 AM.
    Help keep this forum clean: Remember to mark your thread as resolved · Search before you post · Remember to rate posts that help

    VS2010: Visual Studio 2010 Keybinding Posters
    · Service Pack 1
    Tools: GhostDoc - automatically generates XML documentation comments
    · NuGet package Manager · PowerCommands IDE extensions
    Source Control: ankhsvn - integration for SVN
    · Windows Shell Extension for Subversion

    Development Laptop: Intel Core i5 430M 2.26 GHz @ 2.53 GHz
    · 4096 MB, DDR3 PC3-8500F (533 MHz), Kingston · ATI Mobility Radeon HD 5470 · 15.6 @ 16:9, 1366x768 pixel, HD LED LCD

    I follow:
    JoelOnSoftware - A weblog by Joel Spolsky, a programmer working in New York City, about software and software companies
    ScottGu's Blog - Scott Guthrie works for Microsoft as the Product Manager of the .NET Framework
    Portugal-a-Programar - Portuguese Developers Community
    .NET Rocks! - is a weekly Internet audio talk show for .NET Developers.

    Programming Languages:
    C#
    · VB.NET · JAVA · PHP · Javascript
    Other:
    XML
    · HTML · CSS · JQuery · SQL



    *** Proudly Portuguese ***

  2. #2

    Thread Starter
    Frenzied Member zuperman's Avatar
    Join Date
    Dec 2000
    Location
    Portugal
    Posts
    1,033

    Re: SSRS IIF statement

    I figured out

    Code:
    =IIF(Fields!tipo.Value=0, monthname(IFF(int(right(Fields!mensalidadeId.Value,2))>12,1,int(right(Fields!mensalidadeId.Value,2)))) & " " & int(left(Fields!mensalidadeId.Value,4)),int(left(Fields!mensalidadeId.Value,4)))
    http://social.msdn.microsoft.com/For...-a89e363b5d46/

    Thx...
    Help keep this forum clean: Remember to mark your thread as resolved · Search before you post · Remember to rate posts that help

    VS2010: Visual Studio 2010 Keybinding Posters
    · Service Pack 1
    Tools: GhostDoc - automatically generates XML documentation comments
    · NuGet package Manager · PowerCommands IDE extensions
    Source Control: ankhsvn - integration for SVN
    · Windows Shell Extension for Subversion

    Development Laptop: Intel Core i5 430M 2.26 GHz @ 2.53 GHz
    · 4096 MB, DDR3 PC3-8500F (533 MHz), Kingston · ATI Mobility Radeon HD 5470 · 15.6 @ 16:9, 1366x768 pixel, HD LED LCD

    I follow:
    JoelOnSoftware - A weblog by Joel Spolsky, a programmer working in New York City, about software and software companies
    ScottGu's Blog - Scott Guthrie works for Microsoft as the Product Manager of the .NET Framework
    Portugal-a-Programar - Portuguese Developers Community
    .NET Rocks! - is a weekly Internet audio talk show for .NET Developers.

    Programming Languages:
    C#
    · VB.NET · JAVA · PHP · Javascript
    Other:
    XML
    · HTML · CSS · JQuery · SQL



    *** Proudly Portuguese ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width