Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Problem with a date formula Post Reply Post New Topic
Author Message
e11-19
Newbie
Newbie


Joined: 08 Oct 2012
Online Status: Offline
Posts: 2
Quote e11-19 Replybullet Topic: Problem with a date formula
     Posted: 08 Oct 2012 at 12:26am
Apologies if this is in the wrong place for my question.
 
I am very new in this area. So appologies too, if I use wrong wordings.
I have to create a date variable like this.
I have a selection variable, where i can put the actual date by startin the report.
 
So...
xxx type date (Deklaration of a variable type date ??? I dont know how?? )
 
If (the selected date) >= 01.10. yyyy (1st October year yyyy)
xxx= 30.09.yyyy
else
xxx=30.09.yyyy-1
 
What is the correct syntax in crystal reprots to create this formula?
 
Thanks to all.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 08 Oct 2012 at 3:49am
How are you determining what yyyy is?  Is there a particular reason why you need a variable and can't just use the results of a formula?
 
Assuming you're looking for the year of the current date and that "the selected date" is entered by the user, try this (no variable needed...):
 
1.  In the Field Explorer, create a date parameter called "Selected Date"
 
2.  Your formula will look like this:
 
if {?Selected Date} >= Date(Year(currentdate), 10, 1) then
  Date(Year(currentdate), 9, 30)
else
  Date(Year(currentdate)-1, 9, 30)
 
-Dell
IP IP Logged
e11-19
Newbie
Newbie


Joined: 08 Oct 2012
Online Status: Offline
Posts: 2
Quote e11-19 Replybullet Posted: 08 Oct 2012 at 4:31am

You are great. Thanks Smile

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