Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Search Parameters and display field issues Post Reply Post New Topic
Author Message
namitanamburi
Newbie
Newbie


Joined: 26 Mar 2009
Online Status: Offline
Posts: 39
Quote namitanamburi Replybullet Topic: Search Parameters and display field issues
     Posted: 23 Apr 2009 at 10:26am
Hello,

I have successfully created the reports with Parameter fields.
Now I have a question with the search parameter.

Databse is Oracle 10g.

my current report is like this

Name          Designation    Status

John sam       Chef           0

Mill Mathew    Waiter         1

Adam Milsam  Bartender        1


What this actually means is that John sam who was a chef is currently in '0' status which

means inactive.


'1' means active.

Active is stored in database table with datatype varchar2(1).It is a flag that takes values

of '0' or '1'.

Qns 1:Can I display this field as 'Active'or 'Inactive' instead of '0' or '1'.


My report should actually be displayed like this.


Name          Designation    Status

John sam       Chef          Inactive

Mill Mathew    Waiter        Active

Adam Milsam Bartender      Active


How do I do this? Is it got something to do with To char?

To generate the above report I have written a query like this

select First_Name || ' ' || Last_Name as name, designation , status from table emp.

Qns 2 : How will changing this '0' or '1' to 'active','inactive' impact my search criterion.

Because my report has a Parameter field called 'status' in it which is connected to status field in database.


qns 3:  I actually have first name and last names in the table and then I concatenated it and displayed it as Name and then I have created a parameter field for name and in the sort expert I have written the following formula


{Command.Name} like ("*"+ UpperCase({?name})+"*")

which actually means that we can search for Any string of characters and if they are found

anywhere in the name, you will be returned that value.


Eg: if you search for 'sam' in the name


You will get both


Name          Designation    Status

John sam       Chef           0

Adam Milsam  Bartender        1


I want to let everyone search by only those characters with which the last name/first name begins.

If in john sam, john is first name and Sam is the last name then I want people to be able

to search by 's'  or 'sa' or may be more characters but the results have to be

dislayed with all people whose first or last name begins with those characters.

In short the above search has to return only


Name          Designation    Status

John sam       Chef           0


Please reply.


Thanks
Namita














IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Apr 2009 at 11:19am
For your display of active or inactive you can use a formula field to replace your 0 and 1.
if {table.statusfield}=1 then "Active" else "Inactive"
place this on your detail instead of the status field. It does impact your search criteria unless you add it to the select statment in crystal.
For your name search it will be easier to not concantenate the name when bringing it in to crystal. Bring them in as two seperate fields or bring in two seperate fields and your concantenated field or add them together in a formula field in crystal.
Create a parameter "Name Search" as a string.
in your crystal select statement add the search there:
table.fname like ({?name Search} + "*") or table.lname like ({?name Search} + "*")
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