Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: FORMULA FOR DATES NOT WORKING Post Reply Post New Topic
Author Message
BoltzGirl
Groupie
Groupie
Avatar

Joined: 22 Jan 2013
Online Status: Offline
Posts: 89
Quote BoltzGirl Replybullet Topic: FORMULA FOR DATES NOT WORKING
    Posted: 21 Feb 2017 at 11:28am
I can’t figure out why this formula is not working and coming to the experts to see what I am missing.


dateVar EndMonth := Date(Year(DataDate),Month(DataDate),01)-1;
If {?Beg Request Date} = Date(1800,01,01) Then
Date(Year(EndMonth),Month(EndMonth),01)
else
If {?Beg Request Date} = Date(1900,01,01) Then
date(year(currentdate),month(currentdate),1)
else
if {?Beg Request Date} = Date(1850,01,01) then
Local DateVar Start := ((Minimum(LastFullWeek))+1); Local DateVar End :=
((Maximum(LastFullWeek))-6)


They each work separately in Crystal reports fine, when I comment all out and use just one at a time. When I combine the last part, it reads nothing but that last part and gives me the full week. If I use 01/01/1800 it will not give me the prev month. Help :-) TIA
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 22 Feb 2017 at 4:37am
It took a few minutes of testing, but I found a solution, but I also do not recommend declaring variables and assigning them in code.  But if you enclose the last line in parenthesis, then I believe the code will work.

(Local DateVar Start := ((Minimum(LastFullWeek))+1); Local DateVar End :=
((Maximum(LastFullWeek))-6))
IP IP Logged
BoltzGirl
Groupie
Groupie
Avatar

Joined: 22 Jan 2013
Online Status: Offline
Posts: 89
Quote BoltzGirl Replybullet Posted: 22 Feb 2017 at 4:45am
That did work for this scenario!! Thank you so much!
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.015 seconds.