Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Problem w/if statement Post Reply Post New Topic
Author Message
dawnh44
Groupie
Groupie


Joined: 25 Sep 2011
Online Status: Offline
Posts: 79
Quote dawnh44 Replybullet Topic: Problem w/if statement
     Posted: 25 Oct 2011 at 5:48am
Hello everyone,
 
I was able to manipulate the following "If" statement for our Semi-Annual reports.  Currently, the statemen will look at the effective date and give me the Prior Period of 6 months with this formula.  My boss would like to also like this to pull not only for November, but also for May.  I'm at a total loss.  Please see the following formula:
 
If {S_DOC_AGREE.ATTRIB_39} = 'Quarterly' then
    If date({S_DOC_AGREE.eff_start_dt}) > dateadd("m", -6, date({?year}, {?month}, 01)) then
        If date({S_DOC_AGREE.eff_start_dt}) >= dateadd("m", -3, date({?year}, {?month}, 01)) then
            "N/A"
        else
            cstr(totext(date({S_DOC_AGREE.eff_start_dt}),"MM/dd/yy")) + "-" + cstr(totext(dateadd("m", -3, dateadd("d", -1, date({?year}, {?month}, 01))), "MM/dd/yy"))
    else
        cstr(totext(dateadd("m", -6, date({?year}, {?month}, 01)), "MM/dd/yy")) + "-" + cstr(totext(dateadd("m", -3, dateadd("d", -1, date({?year}, {?month}, 01))), "MM/dd/yy"))
else
    If date({S_DOC_AGREE.eff_start_dt}) > dateadd("m", -12, date({?year}, {?month}, 01)) then
        "N/A"
    else
        cstr(totext(dateadd("m", -12, date({?year}, {?month}, 01)), "MM/dd/yy")) + "-" + cstr(totext(dateadd("m", -6, dateadd("d", -1, date({?year}, {?month}, 01))), "MM/dd/yy"))
 
Can anyone help me?
 
Thank you in advance.
IP IP Logged
SamD
Newbie
Newbie


Joined: 24 Oct 2011
Online Status: Offline
Posts: 15
Quote SamD Replybullet Posted: 25 Oct 2011 at 7:10am
Dawn,
Would you be able to send example that might be easier for to help.
 
IP IP Logged
dawnh44
Groupie
Groupie


Joined: 25 Sep 2011
Online Status: Offline
Posts: 79
Quote dawnh44 Replybullet Posted: 26 Oct 2011 at 3:08am
Hello,
 
I was actually able to figure out the problem.
 
Thank you so much for replying.
 
Have a wonderful day.
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