Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Filter based on partial match Post Reply Post New Topic
Author Message
rftd
Newbie
Newbie


Joined: 09 Jun 2008
Online Status: Offline
Posts: 24
Quote rftd Replybullet Topic: Filter based on partial match
     Posted: 09 Jun 2009 at 1:05pm
Hi,

I'm trying to filter data (using selection formulas and parameters) using a 'partial match'. Let me explain more clearly below:

Lets say there is some parameter, PARAMETER_1, which allows the user to enter any custom value. Crystal reports would then filter the data, eliminating anything that did not match the parameter (e.g. if 'dog' was entered as the parameter, then 'cat', 'mouse', etc. would be eliminated). This, of course, is simple, straightforward use of parameters/selection formulas.

What I want to do is slightly different. I want to be able to keep any entry that even partially matches the parameter. Consider the following table from a database.

Purchse#    Customer    Product Purchased
1                    Jon              Dog
2                    Joe              Clogs
3                    Jim               House
4                    Jack             Goggles
5                    Jane            Cat

Then, lets say a report was created in crystal reports. This report has a parameter which is used to filter the data based on the 'Product Purchased' Column. So, lets say I entered 'og' as the parameter. Then, I would want crystal reports to select the rows with 'Dog', 'Clogs', and 'Goggles'. And, obviously, it would eliminate the rows with 'House' and 'Cat' because they do not contain 'og'.

Note that I want crystal reports to select any entry with even a partial match to the parameter.


Thanks in advance.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Jun 2009 at 1:47pm
instr({table.field},{?parameter_1},1)>0
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