Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Crystal Syntax, Date Searching. Post Reply Post New Topic
Author Message
smilbuta
Newbie
Newbie


Joined: 25 Apr 2007
Online Status: Offline
Posts: 2
Quote smilbuta Replybullet Topic: Crystal Syntax, Date Searching.
    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.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet 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
IP IP Logged
smilbuta
Newbie
Newbie


Joined: 25 Apr 2007
Online Status: Offline
Posts: 2
Quote smilbuta Replybullet 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!
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet 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
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.031 seconds.