Print Page | Close Window

Compare Instr to Current Date

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=13149
Printed Date: 05 May 2025 at 8:11am


Topic: Compare Instr to Current Date
Posted By: Rosie111
Subject: Compare Instr to Current Date
Date Posted: 09 May 2011 at 9:20am
Hi,
I am very, very new to Crystal Reports and got a hard one right away (I think anyway).
 
I need to filter a report based on a field in Excel that holds data such as:
"Jan, Mar, Apr, Nov, Dec" which needs to match the current month.  So, if today is in May and May is somewhere in the field ({Joblog_.FREQUENCY DETAIL} then I want that record.  That is the hard part for me. 
 
Also in the filter (The easier part) is that
{Joblog_.FREQUENCY DETAIL} could also be empty and
{Joblog_.FREQUENCY} has to be "Monthly" and last,
{Joblog_.DUE DATE} has to equal 1.00.
 
FREQUENCY DETAIL is a text field in Excel.
This is what I have tried and do not get the correct results.  I'm sure it has to do with the date part and instr, as I do not know the correct way to write it.

Local StringVar mnth := totext(CurrentDate,"mmm");

{Joblog_.FREQUENCY} = "MONTHLY" and

{Joblog_.DUE DATE} = 1.00 and

isnull({Joblog_.FREQUENCY DETAIL}) OR

{Joblog_.FREQUENCY} = "MONTHLY" and

{Joblog_.DUE DATE} = 1.00 and

INSTR({Joblog_.FREQUENCY DETAIL}, mnth) = 1

Like I said, I am very new with Crystal and do not know the correct syntax for the instr or the date function.  Can someone please help!
Thank you.
 


-------------
Lisa



Replies:
Posted By: lockwelle
Date Posted: 18 May 2011 at 3:36am
probably you want the instr to be > 0...it is in the string.  it's probably 1.  The other consideration would be casing...
 
but here is the big issue...toText should use "MMM" which is month "mmm" is minutes.
 
Hope this isn't too late



Print Page | Close Window