Tips and Tricks
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Tips and Tricks
Message Icon Topic: If Statement Post Reply Post New Topic
Author Message
JaneKOS
Newbie
Newbie


Joined: 14 Aug 2010
Online Status: Offline
Posts: 3
Quote JaneKOS Replybullet Topic: If Statement
    Posted: 14 Aug 2010 at 12:07pm
I have 2 years worth of forecasts stored in my MSC_TBL. I've written a crystal report to pull through quantities forecast by month, starting with the current month and showing a rolling 12 months.
 
Using the following I'm returning both 2010 & 2011 values. I want to bring back only 2010 if it exists, if not then only 2011 values.

if month({MSC_TBL.MSC_DUE_DATE})={@month1}AND
YEAR ({MSC_TBL.MSC_DUE_DATE})=YEAR(TODAY)then{MSC_TBL.MSC_ORIG_QTY}
else
if month({MSC_TBL.MSC_DUE_DATE})={@month1}AND
year ({MSC_TBL.MSC_DUE_DATE})=(year(today)+1)then {MSC_TBL.MSC_ORIG_QTY}
else 0

Any help greatly appreciated.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 19 Aug 2010 at 3:23am
not sure if this will help, it is just a reformat of what you have...
 
local numbervar yr := YEAR ({MSC_TBL.MSC_DUE_DATE});
if month({MSC_TBL.MSC_DUE_DATE})={@month1} THEN(
 if yr =YEAR(TODAY) OR yr = YEAR(TODAY) + 1 then
  {MSC_TBL.MSC_ORIG_QTY}
 else
  0
 )
else
 0
 
HTH
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.