Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Error: String required Post Reply Post New Topic
Author Message
Nav522
Senior Member
Senior Member


Joined: 25 Aug 2009
Location: United States
Online Status: Offline
Posts: 166
Quote Nav522 Replybullet Topic: Error: String required
     Posted: 26 Oct 2009 at 8:36am
Hello Folks,
I have this formula in the record selection criteria below which gives the data from Is day of current month until previous day. But somehow its returning error that string is required. I believe totext() condition will do but is tht all i need to do?
 
 
 
if {table.RECOVERY_MONTH} IN cdate(year(currentDate), month(currentDate), 1) to cdate(year(currentDate), month(currentDate), day(currentDate)-1) then
True
Else
False
 
 
Thanks,
 
Nav


Edited by Nav522 - 26 Oct 2009 at 8:56am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 26 Oct 2009 at 9:13am

In the select statement you do not need the "If THen" as it will already evaluate to T/F.

Although I think you are trying to only include records that are "dated" between the first of the month and 'yesterday' but you date field is 3 different field for Day, Month and Year. Is this correct?
if so are these numeric or text feilds.
also if today is the first of the month do you want to see last month of just today?


Edited by DBlank - 26 Oct 2009 at 9:14am
IP IP Logged
Nav522
Senior Member
Senior Member


Joined: 25 Aug 2009
Location: United States
Online Status: Offline
Posts: 166
Quote Nav522 Replybullet Posted: 26 Oct 2009 at 10:22am
Hey thanks for getting bak, Well i have the recovery_month field in my table as a Varchar but i dont think the date field has 3 different fields for date,month and year( if i understood the question correctly). and yeah if today is first day of the month i need to see the previous month. i apologize if i cudnt explain u clearly.
 
 
Thanks


Edited by Nav522 - 26 Oct 2009 at 10:32am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 26 Oct 2009 at 10:44am

I think you want something like this (replace my psuedo day, month year fields with your real day, month and year fields):

if day(currentdate)=1 then
cdate(tonumber({table.year}),tonumber({table.MOnth}),tonumber({table.day})) in lastfullmonth else
cdate(tonumber({table.year}),tonumber({table.MOnth}),tonumber({table.day})) in dateadd('d',-day(currentdate) + 1, currentdate) to dateadd('d',-1, currentdate)


Edited by DBlank - 26 Oct 2009 at 10:47am
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