Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Using multiple wildcards in selection formula Post Reply Post New Topic
Page  of 2 Next >>
Author Message
theotherdodge
Groupie
Groupie


Joined: 17 Nov 2008
Online Status: Offline
Posts: 40
Quote theotherdodge Replybullet Topic: Using multiple wildcards in selection formula
    Posted: 14 Nov 2012 at 3:51am
Is there a way that I can create a parameter that will allow the user to input mulitple search items?
 
For example, the user would enter:  gloves,hat,glasses and those terms would search a description field for any of those?
 
I can get it to work for a single wildcard term or even multiple but if the description field contains that search term and another word, it wont pick it up.  So basically I need to use a "like" statement...
 
(if {?DescWildcard} <> 'x' then not (IF "," & lowercase({POIT.Description}) & "," IN "," & {?DescWildcard} & "," THEN 0=1 ELSE 1=1) else 1=1)
 
Thanks!
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 14 Nov 2012 at 5:16am
field like '*' + {parm?} + '*'

you will have to remind users to use wildcards in the parameter statement,

or if you want commas

field like


{field} like '*'+ Replace({parm?},',' ,'*' )+'*'
IP IP Logged
theotherdodge
Groupie
Groupie


Joined: 17 Nov 2008
Online Status: Offline
Posts: 40
Quote theotherdodge Replybullet Posted: 14 Nov 2012 at 5:37am
That didn't work...at least from what I tested...
 
and lowercase({POIT.Description}) like '*'+ Replace({?DescWildcard},',' ,'*' )+'*'
 
When I just put in 1 description, it works fine.  But if I put in multiple, it doesn't pull anything.
 
ex:  goggles,wax
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 14 Nov 2012 at 5:40am
Originally posted by theotherdodge



That didn't work...at least from what I tested...
 
and lowercase({POIT.Description}) like '*'+ Replace({?DescWildcard},',' ,'*' )+'*'
 
When I just put in 1 description, it works fine.  But if I put in multiple, it doesn't pull anything.
 
ex:  goggles,wax


lowercase({POIT.Description}) like '*'+ Replace({POIT.Description},',' ,'*' )+'*'

this should work


Edited by comatt1 - 14 Nov 2012 at 5:42am
IP IP Logged
theotherdodge
Groupie
Groupie


Joined: 17 Nov 2008
Online Status: Offline
Posts: 40
Quote theotherdodge Replybullet Posted: 14 Nov 2012 at 6:01am
that didn't work..
did you mean:  lowercase({POIT.Description}) like '*'+ Replace({?DescWildcard},',' ,'*' )+'*'
Replace({parameter})....But even that didn't work?
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 14 Nov 2012 at 6:03am
what is the input parameter on the field?

you may have to use an array

Edited by comatt1 - 14 Nov 2012 at 6:05am
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 14 Nov 2012 at 6:14am
Local NumberVar Array b;
local numbervar count ab:=
LENGTH({?DescWildcard}) - LENGTH(REPLACE({?DescWildcard}, 'Y', ''));
Redim b[ab];
Local NumberVar i;
For i := 1 To ab Do
(
   b := ab * i
);

and lowercase({POIT.Description}) in **** have no idea if this can work, DELL LOCK HELP
IP IP Logged
theotherdodge
Groupie
Groupie


Joined: 17 Nov 2008
Online Status: Offline
Posts: 40
Quote theotherdodge Replybullet Posted: 14 Nov 2012 at 9:46am
I can't use an array because of the system that runs Crystal doesn't allow it...
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 14 Nov 2012 at 9:53am
(if LENGTH({?DescWildcard}) - LENGTH(REPLACE({?DescWildcard}, ',', ''))=LENGTH({?DescWildcard}) then
lowercase({POIT.Description}) = {?DescWildcard} else
lowercase({POIT.Description}) in [{?DescWildcard}])

if they delineate with commas this should work

this works with a single parm, if descwildcard always will be matt,been,grease

it will work

Edited by comatt1 - 14 Nov 2012 at 9:54am
IP IP Logged
theotherdodge
Groupie
Groupie


Joined: 17 Nov 2008
Online Status: Offline
Posts: 40
Quote theotherdodge Replybullet Posted: 14 Nov 2012 at 11:00am
Thanks comatt1. Still no joy.
POIT.Description will usually contain a set of words such as "gas masks" or "safety masks" or "half face masks" or "freight" or "freight charges".
The user wants to be able to enter search words in the parameter to pick up those records such as: "mask,freight"
IP IP Logged
Page  of 2 Next >>
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.