Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Parameters and Select Expert XI Post Reply Post New Topic
Author Message
cheryla
Groupie
Groupie


Joined: 23 Oct 2013
Online Status: Offline
Posts: 51
Quote cheryla Replybullet Topic: Parameters and Select Expert XI
     Posted: 05 Feb 2014 at 10:21am
I have a report where I need for the user to select only a portion of a field. For example:
 
The field is a descritption field with many options. So lets use ABCDEF, ACDEFG, ADEFGH
 
I want the user to ask for the following: AB* or possibly AC* and pull in the respective description.
 
So I set up a parameter formula that states my value field is description and is a string. Now what do I do in select criteria to get the option of only asking for the first 2 characters of my description field?
 
Appreciate any helpful info.
 
Thanks!!


Edited by cheryla - 06 Feb 2014 at 4:48am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 06 Feb 2014 at 5:10am
why not have do something like the following, since this is really going against the record filter for the report:
local stringvar param:={@parameter};
local numbervar asterick:=instr(param, "*");//returns 0 if no * is found
if asterick = 0 then asterick = len(param) + 1;//adjusts for if no asterick is in the parameter
if asterick > 0 then param = left(param, asterick-1);//what are the letters chosen?
left({table.field}, asterick-1) = param //return true(include in report) if the field starts with the same letter, and false(exclude) if it doesn't

I am not sure what would happen if the user just enters *, but for all other occasions this should work, whether the user uses the asterick or not (wants an exact match)

HTH


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