Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Help with iif Post Reply Post New Topic
Author Message
nkdatana
Newbie
Newbie


Joined: 23 May 2012
Online Status: Offline
Posts: 2
Quote nkdatana Replybullet Topic: Help with iif
     Posted: 23 May 2012 at 7:00am
I am having a problem with a formula containg an if statement.  Can anyone help
IIF ({EQ_MAIN.DEPREC_MONTHS_LIFE} = 0, "NA",  ToText ((DateAdd ("m", ({EQ_MAIN.DEPREC_MONTHS_LIFE}), ({EQ_MAIN.IN_SERVICE_DATE}), "MM/dd/yyyy" ))))
 
I get an error that says "Too many arguments have been given to this function"
 
I don't know how to post a screen
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 May 2012 at 7:39am
IIF (
{EQ_MAIN.DEPREC_MONTHS_LIFE} = 0, "NA",
 ToText
    (DateAdd("m",{EQ_MAIN.DEPREC_MONTHS_LIFE},{EQ_MAIN.IN_SERVICE_DATE}), "MM/dd/yyyy" )
)
IP IP Logged
nkdatana
Newbie
Newbie


Joined: 23 May 2012
Online Status: Offline
Posts: 2
Quote nkdatana Replybullet Posted: 23 May 2012 at 12:16pm
Thanks.  I had figured it out before I go thte response here.  However I used CStr.  Is there any benefit to using ToText instead
 
IIF ({EQ_MAIN.DEPREC_MONTHS_LIFE} = 0, "NA",  CStr ((DateAdd ("m", ({EQ_MAIN.DEPREC_MONTHS_LIFE}), ({EQ_MAIN.IN_SERVICE_DATE}))), "MM/dd/yyyy" ))
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 May 2012 at 3:59am
totext and cstr are the same so no added value either way
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum