Print Page | Close Window

Crystal Syntax, Date Searching.

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
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=588
Printed Date: 07 May 2024 at 10:17am


Topic: Crystal Syntax, Date Searching.
Posted By: smilbuta
Subject: Crystal Syntax, Date Searching.
Date Posted: 26 Apr 2007 at 7:29am
Hello,
 
I am currently developing an application using VS2005 and Crystal Reports.
 
I wish to pass a Crystal Syntax statement to the report that searches for like dates in a date column in a SQL 2005 Database..
 
The statments as follows.

crystalsyntax = "{EQ_Equipment.equipment_warranty} like '*2009*'"
I get returned an error saying string expected??
 
so i tested diferent formats, and if i use this string i get only one record returned out of a known test group of 10 records.
 
"{EQ_Equipment.equipment_warranty} Like DateValue('*2009*')"
 
so im unsure what im doing wrong. Any advice would be apreciated.



Replies:
Posted By: hilfy
Date Posted: 26 Apr 2007 at 9:38am
Try using:
 
year({EQ_Equipment.equipment_warranty}) = 2009
 
This will process in Crystal instead of on the database, so it may take a little longer, but it should work.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: smilbuta
Date Posted: 26 Apr 2007 at 1:28pm
Hello Thank you, I tested the line you provided and it returns one row only and that row being the first record that contains 2009.
 
what kind of syntax would i make if iwanted to searcha date feild like it was a string?.. for example.. look for the number 5...
 
Ill get all may occurences, all days with 5 (5 15,25), and any record in 95, 2005.. ect... how would one build that statment?
 
 
 
 
Im new to CR so if my question seems absurd im sorry, perhaps you could show a proper solution to my dilema.
 
Thank you for any help!


Posted By: hilfy
Date Posted: 26 Apr 2007 at 1:40pm
How is your report grouped?  What section do you have your data in?  This will help me figure out why you're not seeing the data you're looking for.
 
To search a data like a text string, create the following formula:
 
InStr(ToText({EQ_Equipment.equipment_warranty}, 'yyyyMMdd'), {?DateString}) > 0
 
Please note that the format string in ToText is case sensitive!
 
{?DateString} would be a Crystal parameter you create to accept the number string you want to search for.
 
In the Select Expert, add this formula and select "Is True".
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window