how to change "-1" to "yes" value in Crystal Report field?
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开发者_如何学JAVA "No".
how i can do it ?
thank's in advance
You can create a Formula field in Crystal and use code such as
if (field=-1) then
"Yes"
else
"No"
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.
精彩评论