views:

122

answers:

2

hi

how to change "-1" to "yes" value in Crystal Report field ?

i have database that connect to crystal report, one field has "-1" value

i whant to change it to "yes" and "0" value to "No".

how i can do it ?

thank's in advance

+1  A: 

Instead of doing this at report rendering time, I suggest you do this in the SQL statement that fetches your data.

For ex. in SQL Server, I would use a CASE statement to achieve this.

SELECT case when MyField = -1 then "Yes" ELSE "No" End As NewValue,
Column2, Column3
From Table

If you have a lot of rows, then doing this in the database will be done in a SET Based manner rather than the RBAR that will happen while rendering. A SET operation will almost always be faster than a RBAR.

Raj More
Is there a greater value doing it this way?
Adam Smith
yes, answer edited for RBAR vs Set
Raj More
+4  A: 

You can create a Formula field in Crystal and use code such as

if (field=-1) then 
"Yes"
else
"No"
astander