SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


similar function in Ireport like IIF in Crystal Reports


similar function in Ireport like IIF in Crystal Reports

Author
Message
anandhaksc
anandhaksc
Valued Member
Valued Member (65 reputation)Valued Member (65 reputation)Valued Member (65 reputation)Valued Member (65 reputation)Valued Member (65 reputation)Valued Member (65 reputation)Valued Member (65 reputation)Valued Member (65 reputation)

Group: General Forum Members
Points: 65 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
derek.colley
derek.colley
SSC Eights!
SSC Eights! (896 reputation)SSC Eights! (896 reputation)SSC Eights! (896 reputation)SSC Eights! (896 reputation)SSC Eights! (896 reputation)SSC Eights! (896 reputation)SSC Eights! (896 reputation)SSC Eights! (896 reputation)

Group: General Forum Members
Points: 896 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
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:
CAST(SUBSTRING(CAST(FLOOR(NULLIF(ISNULL(COALESCE(1,NULL),NULL),NULL)) AS CHAR(1)),1,1) AS INT) == 1
So why complicate your code AND MAKE MY JOB HARDER??!Crazy

Want to get the best help? Click here http://www.sqlservercentral.com/articles/Best+Practices/61537/ (Jeff Moden)
My blog: http://uksqldba.blogspot.com
Visit http://www.DerekColley.co.uk to find out more about me.

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search