Log in  ::  Register  ::  Not logged in

 Recent PostsRecent Posts Popular TopicsPopular Topics
 Home Search Members Calendar Who's On

 similar function in Ireport like IIF in Crystal Reports Rate Topic Display Mode Topic Options
Author
 Message
 Posted Tuesday, October 30, 2012 3:33 AM
 SSC Rookie Group: General Forum Members Last Login: Thursday, March 3, 2016 6:03 AM Points: 45, Visits: 62
 Dear All, Any function available in Ireport which has same functionality like Crystal Reports IIF Function.If its so then tell me with some simple example . Please help me and thanks in advance..Regards,T.Anandhaksc
Post #1378637
 Posted Tuesday, October 30, 2012 4:15 AM
 SSC-Addicted Group: General Forum Members Last Login: Thursday, October 1, 2015 5:02 AM Points: 496, Visits: 603
 IF vs IIF: IF is a logical operator - IF a THEN b ELSE c. Whereas IIF is a construct, meaning 'IF and ONLY IF' and the SQL syntax differs - IIF (a, b, c) - which will execute b on TRUE and c on FALSE.In terms of reporting, I would steer clear of IIF and go for IF with a code block for connected statements to execute when evaluated to true to avoid ambiguity and allow for multiple statements e.g.`IF @a = True BEGIN -- do something -- do something else ENDELSE BEGIN -- do something -- do something else END`Rather than:`IIF (@a = True, do something, do something)`There's an interesting discussion on the mathematical differences of IF and IIF over on Wikipedia (link below), and how the English term of IF and ONLY IF is actually wrong (should be ONLY IF and IF). Links below.IIF: http://msdn.microsoft.com/en-us/library/hh213574.aspxIF.. ELSE: http://msdn.microsoft.com/en-us/library/ms182717.aspxWikipedia: http://en.wikipedia.org/wiki/If_and_only_if ---Note to developers: CAST(SUBSTRING(CAST(FLOOR(NULLIF(ISNULL(COALESCE(1,NULL),NULL),NULL)) AS CHAR(1)),1,1) AS INT) == 1So why complicate your code AND MAKE MY JOB HARDER??!Want to get the best help? Click here http://www.sqlservercentral.com/articles/Best+Practices/61537/ (Jeff Moden)My blog: http://uksqldba.blogspot.comVisit http://www.DerekColley.co.uk to find out more about me.
Post #1378654

 Permissions

 Copyright © 2002-2016 Redgate. All Rights Reserved. Privacy Policy. Terms of Use. Report Abuse.