Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formula Field to concatenate date and text Post Reply Post New Topic
Author Message
nkdata
Newbie
Newbie


Joined: 30 Sep 2014
Online Status: Offline
Posts: 6
Quote nkdata Replybullet Topic: Formula Field to concatenate date and text
     Posted: 02 Oct 2014 at 8:30am
I'm a newbie, it doesn't seem like it should be too hard, but I keep getting an error.
I need help to create a formula field in Crystal Reports 2008. I need the field to take the current year, if the "from date of service" is greater than or equal to 01/01/current year, it should enter the quarter of the service year (ex: 3 Qtr 2014). If the "from date of service" is less than the current year, it should enter CY + year of service (ex: CY 2012).

In excel it looks like this
IF(D1>=1/1/2014,INT(INT(MONTH(D1)+2)/3)&"-"&"QTR"&" "&TEXT(D1,"YYYY"),"CY"&"-"&TEXT(D1,"YYYY"))
where D1 is the cell containing the "from date of service"

Can you help???
new to this I NEED HELP
IP IP Logged
nkdata
Newbie
Newbie


Joined: 30 Sep 2014
Online Status: Offline
Posts: 6
Quote nkdata Replybullet Posted: 02 Oct 2014 at 10:08am
How can I modify this

if Year({Command.FROMDATESVC}) = Year (CurrentDate) then INT(INT(MONTH({Command.FROMDATESVC})+2)/3) else Year ({Command.FROMDATESVC})

to add the "Qtr" or "CY" text??
new to this I NEED HELP
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 07 Oct 2014 at 8:28am
You did not state whether you wanted the Qtr or CY before or after the number, but basically you need probably do a totext function (i.e., totext(INT(INT(MONTH({Command.FROMDATESVC})+2)/3),0)  ), then just add the text (i.e., totext(INT(INT(MONTH({Command.FROMDATESVC})+2)/3),0) + " Qtr" )
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