Author |
Message |
theotherdodge
Groupie
Joined: 17 Nov 2008
Online Status: Offline
Posts: 40
|
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 Logged |
|
comatt1
Senior Member
Joined: 19 May 2011
Online Status: Offline
Posts: 337
|
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 Logged |
|
theotherdodge
Groupie
Joined: 17 Nov 2008
Online Status: Offline
Posts: 40
|
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 Logged |
|
comatt1
Senior Member
Joined: 19 May 2011
Online Status: Offline
Posts: 337
|
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 Logged |
|
theotherdodge
Groupie
Joined: 17 Nov 2008
Online Status: Offline
Posts: 40
|
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 Logged |
|
comatt1
Senior Member
Joined: 19 May 2011
Online Status: Offline
Posts: 337
|
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 Logged |
|
comatt1
Senior Member
Joined: 19 May 2011
Online Status: Offline
Posts: 337
|
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 Logged |
|
theotherdodge
Groupie
Joined: 17 Nov 2008
Online Status: Offline
Posts: 40
|
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 Logged |
|
comatt1
Senior Member
Joined: 19 May 2011
Online Status: Offline
Posts: 337
|
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 Logged |
|
theotherdodge
Groupie
Joined: 17 Nov 2008
Online Status: Offline
Posts: 40
|
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 Logged |
|
|