Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: if statement?? Post Reply Post New Topic
Author Message
south
Groupie
Groupie


Joined: 31 Jul 2012
Online Status: Offline
Posts: 82
Quote south Replybullet Topic: if statement??
     Posted: 06 Dec 2012 at 10:24am
I need to create a report that will only show me records that have dates within 2 weeks of the current date and older.  And any record that has more than 40 hours.
IP IP Logged
Schugs
Newbie
Newbie


Joined: 08 Aug 2012
Online Status: Offline
Posts: 36
Quote Schugs Replybullet Posted: 06 Dec 2012 at 10:51am
{datefield} < CRDate(dateadd("d",40,printdate)) and
{hours.field}<40
IP IP Logged
south
Groupie
Groupie


Joined: 31 Jul 2012
Online Status: Offline
Posts: 82
Quote south Replybullet Posted: 07 Dec 2012 at 3:14am
It doesn't work, the message I receive says "too many arguments have been given to this function" and highlights the ("d",14, printdate)
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 07 Dec 2012 at 3:48am
you single quotes

dateadd('d',14,printdate)
IP IP Logged
south
Groupie
Groupie


Joined: 31 Jul 2012
Online Status: Offline
Posts: 82
Quote south Replybullet Posted: 07 Dec 2012 at 4:39am
It still gives me the same message.  The date field is a sub report within the main report, I am trying to get that field to work then I can work on the next criteria.  I tried {date.date}<currentdate+14 and it worked with the exception that all records with dates that are further out than 14 days still print but they  print with no date listed on the report. 
IP IP Logged
south
Groupie
Groupie


Joined: 31 Jul 2012
Online Status: Offline
Posts: 82
Quote south Replybullet Posted: 07 Dec 2012 at 4:52am
I want to only print records that are older than the current date +14 day unless they have over 40 hrs.  but since the date field is a sub report within the main report where the hrs are, I cannot do a formula that combines both of these requirements can I?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 10 Dec 2012 at 5:35am
not in the select expert.
You might be able to limit your data to only the date criteria in the main report and then use a shared variable in a sub report to suppressd at int he main report. Just keep in min that the suppression has to happen ina read order after the variable is returned.
Eg. the variable cannot be in the GF and  expect to suppress a GH or details section.
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