Crystal Reports if-then-else help query
You want to create a formula field and add a formula field to your report instead of a gender field. Something like this should work (my syntax might be off a bit)
if {MyTable.sex} = 1
then
"male"
else
"female"
If you are not familiar with formula fields, they are simply expressions that you can use and display in a report. In the Field Explorer sidebar in Crystal Reports, you can see a list of all fields in the database, and so on. Just right click on the formula fields and add a new one. After you create a formula field, drag it into the report layout just like you would any other normal field.
a source to share
Use a formula field. Put say @Sex in your report, then edit it to be something like:
//may need tweaked....
If {database.table.sex} then
male
else
female;
The syntax of my Crystal Formula is really rusty, so it might not be right as written. Maybe it should be:
//may need tweaked....
Stringvar displaySex;
If {database.table.sex} then
displaySex = "male"
else
displaySex = "female";
displaySex
And the end-of-line format (";") may not be correct ....
a source to share