Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula 'Between date' Post Reply Post New Topic
Author Message
wvn14
Newbie
Newbie
Avatar

Joined: 07 Jul 2008
Location: Netherlands
Online Status: Offline
Posts: 3
Quote wvn14 Replybullet Topic: Formula 'Between date'
     Posted: 07 Jul 2008 at 2:24am
Hello,
 
There is a problem i can't resolve and i hope i can get some help.
 
Intro:
I am using a SQL database with defirent type of calls. I wil call this table A, B and C. In these tables are information with the logged date (format: 01-01-2008 23:59:00)
 
Now i have to made a report with a overview with a mount of number of calls that is logged in a period. Period is equal to year.
 
I really have to use a formule, a cross-table is not possible. But now my question. How do i make a formula that is equal to this question:
 
if the logged date is equal to year 2008 then 1.
When I have this formula then i can make a distinct count in my report.
 
I hope there is someone who can help me.
(Excuse me for my poor english)
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 07 Jul 2008 at 2:41am
Hi,
You can use the the formula below
 
year(date('01-01-2008 23:59:00'))
 
replace the ('01-01-2008 23:59:00') with your table.fieldname
 
cheers
Rahul
IP IP Logged
wvn14
Newbie
Newbie
Avatar

Joined: 07 Jul 2008
Location: Netherlands
Online Status: Offline
Posts: 3
Quote wvn14 Replybullet Posted: 07 Jul 2008 at 2:54am
oke thank you, but i forgot to say that it must be a between date:
 
if table.logged date is between year(date('01-01-2008 23:59:00')) and year(date('31-12-2008 23:59:00'))
 
or something like that?
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 07 Jul 2008 at 4:22am
Hi
you can use the year and date function in your  record selection formula to check the between year.
 
if you need user to select the year then you will need to create a view or stored procedure in sql server with the select statement
 
select fields,
year(loggeddate) as 'From Year',
year(loggeddate) as 'To Year'
from table
where ......
 
then create parameters on from_year and to_year fields in your report  then check for them in record selection formula as
 
year(date(table.loggeddate)) in {?from_year} to {?to_year}
 
 
cheers
Rahul
 
 


Edited by rahulwalawalkar - 07 Jul 2008 at 4:22am
IP IP Logged
wvn14
Newbie
Newbie
Avatar

Joined: 07 Jul 2008
Location: Netherlands
Online Status: Offline
Posts: 3
Quote wvn14 Replybullet Posted: 08 Jul 2008 at 12:30am
i understand it is not possible without a view? i will try this with a view
thanks for the help 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