Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Search Post Reply Post New Topic
Author Message
werd1
Newbie
Newbie


Joined: 22 Jan 2008
Online Status: Offline
Posts: 3
Quote werd1 Replybullet Topic: Search
     Posted: 22 Jan 2008 at 2:44pm
Hello,
Im trying to get CR X to search through a field in a table and tell me if a certain filename is there. I wrote a formula to do it and it works, except that it displays the results of each file in the field and creates just as many reports. So if there are 5 files in "filenames" it will create a seperate report for each one with the correct results. I need 1 report with 1 result, but I have to search through all of the items and Im unsure on how to do this. I was thinking of using an array but Im unsure of how to populate it using {Attachments.filename}. I don't know how to cycle through them. Does anyone have any suggestions on how to have it search all items in the field and return only one result? Any suggestions would be appreciated!
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 23 Jan 2008 at 4:42am
OK, I think that I'm very confused as to exactly what you are doing.

When you say "search through a field," do you mean that you are running some kind of SQL against the table, to find records in which the field equals the search value?  Or are you using string functions to find occurrences of the search value within a given record?

When you say it will "create a separate report," what do you mean exactly?  One detail section for each instance?  Multiple occurrences of a subreport?

When you find the search value, what do you want the return to be?  What does the report display now, and what do you want it to display?

A bit of sample data might be useful.
IP IP Logged
werd1
Newbie
Newbie


Joined: 22 Jan 2008
Online Status: Offline
Posts: 3
Quote werd1 Replybullet Posted: 23 Jan 2008 at 1:14pm

Thanks for the reply and sorry for the confusion.

 

I’m currently using a formula to find an occurrence of a search value in a given record.

 

When I run the formula, it creates a separate details section for each instance.

 

When I find the search value, I want it to give me a True, if not, a False.

As of now, it is doing just that, but with a detail section for each instance.

 

Is it possible to search all {Attachments.FileName} instances and return one result in one detail section?

 

This is the formula I’m using now.

 

if {Attachments.FileName}[1 to 3] = "ROP" then TRUE

else False

IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 23 Jan 2008 at 2:00pm
What about suppressing the Details section (but still keeping the formula in it so that each record gets examined) and then in the Report Footer print the True or False result?

If that sounds like what you need, then I would have a Global variable so that it can be shared across formulas. In the formula that goes in the Details section, set the variable to True when the condition is met (but don't ever set it to False b/c that will lose it's previous value). Then for the footer, create another formula which simply prints the variable's current value out.


Edited by BrianBischof - 23 Jan 2008 at 2:06pm
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
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