Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Searching records of filed for repeated text Post Reply Post New Topic
Author Message
Afi83
Newbie
Newbie


Joined: 08 Oct 2009
Online Status: Offline
Posts: 7
Quote Afi83 Replybullet Topic: Searching records of filed for repeated text
    Posted: 14 Oct 2009 at 1:01am
Hi there

I want to search a records in course filed and find the names that repeated in records. For example if math repeated 3 times I want to show only the maximum of the grades in grades field for person and don't consider others.
I do something like this, but I can't do it as described above.
'Here is the basic syntax

if {course.courseName}=next({course.courseName}) then
formula={grades.grade}
end if

What I have to do for solving this;

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 14 Oct 2009 at 6:45am
what you want to do is very complex, as the coursenames don't have to be adjacent, and the order of the grades doesn't have to be sorted.  Crystal doesn't really do this sort of thing well.  I am a thinking a delimited string of the course and the grade, then you can search the string for the course and determine if the grade is higher if so, replace the grade, then finally display the final list of courses and grades...but this fairly involved, and probably cannot be aggregated (summed/averaged).
 
what I would do is build a string that looks like |math^25|english^56| and then use the instr/mid functions to see if the course in the string, and to get the grade.  While this sketchy, it would be alot of work to completely code the formulas, and that is what you paid to do.
 
Hope this gives you a path/idea/inspiration.  You could probably do it via arrays as well, in which case you might be able to use a subreport.
IP IP Logged
Afi83
Newbie
Newbie


Joined: 08 Oct 2009
Online Status: Offline
Posts: 7
Quote Afi83 Replybullet Posted: 14 Oct 2009 at 10:01am
Thanks for your response.
But the course names are in sequence and the maximum number of repetition is 3. Then i think if i can use next(field) i can do what i want. But i do not know how can i check two consecutive records for seeing repetition of it. can you make me clear how can i check two records sequence?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 14 Oct 2009 at 10:06am
using the built in functions, you can't.  if you know that you are the second record you could use previous and next.
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.