cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Chr function

Former Member
0 Likes
4,513

Can somebody point me in the right direction. I cant seem to find anything on the Chr function.

I hope I explain this right.... sometimes I have the need to insert a character or symbol such as arrows or check boxes (like you would find in Excel). I have done this before by using Chr(???)...

Is there some documentation that would tell me what codes to use with Chr? Excel's code do not have same results in CR.

I have used this before but I cant find the report I used it in.... or am I having some memory problems?

View Entire Topic
Former Member
0 Likes

Hi Travis,

I hope this article helps you

KBase Article ID:c2003265

Article refers to:Crystal Reports 7

Symptom

Under specific conditions on a report, you would like a checkbox to be printed. If the conditions are not met, you would like to see a blank box printed.

How can you do this in Crystal Reports?

Resolution

In Crystal Reports, create a formula similar to the following:

1. From 'Insert', select 'Field Object'. This launches the field explorer.

2. From the 'Field Explorer', select 'Formula Fields'.

3. Click the 'New' icon. Type a name, such as "Checkbox" and click 'OK'. This launches the formula editor.

4. Type a formula similar to the following:

//@Checkbox

//When that field is equal to the criteria, you will see a check mark

//When the field is not equal to the criteria; you will see a blank check box

if {Customer.Country} = "USA" then Chr(254) else Chr(168)

NOTE: =====

Of course, you can implement this in different ways, but the Chr( ) function in Crystal Reports is the easiest way to get the formula to output the preferred result.

chr(168) will output just a blank box.

chr(254) will output a box with a check mark inside of it.

chr(252) will output just a check mark.

chr(253) will output a box with an "X" inside.

chr(251) will output just an "X".

==========

5. Insert the formula into the report and format it to use the Wingdings font.

Now, when you refresh your report and the criteria is met, you will see a check mark in the box, and if the criteria is not met the check box will remain blank.

Also if you want to insert some more symbols then

open a word doc and go to Insert>symbol>select the symbol and get the character code and use it in Crystal

chr(character code) which prints the symbol.

Regards,

Raghavendra

Former Member
0 Likes

Thanks guys. It just hit me why I wasnt getting the correct results when using the wingding code. I need to change my formula font type to wingding as well.

Former Member
0 Likes

Hey guys,

Were you able to display the wingdings font correctly when you exported the report as PDF in Infoview ?

I didn't experienced any issue with the font when viewing or exporting the report from CR Designer. However the font didn't translate well when I export it as a PDF document within Infoview.

We're on XIr2 SP2 FP2.6 on Unix Solaris.