October 30, 2012 at 3:33 am
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
October 30, 2012 at 4:15 am
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
END
ELSE
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.aspx
IF.. ELSE: http://msdn.microsoft.com/en-us/library/ms182717.aspx
Wikipedia: http://en.wikipedia.org/wiki/If_and_only_if
---
Note to developers:Want to get the best help? Click here https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help (Jeff Moden)
My blog: http://uksqldba.blogspot.com
Visit http://www.DerekColley.co.uk to find out more about me.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply