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

Chr function

Former Member
0 Likes
4,510

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

Travis, I have copied this from online,

Printing Check Boxes and other Symbols from formulas

Instead of a column that prints "TRUE" and "FALSE", how about printing a check box symbol, with or without the check mark? All you need is the WingDing font, which is on most PCs, and a formula like the following:

If {Order.Shipped} = "T"

then Chr(254)

else Chr(168)

Place this formula on your report and format it to use the WingDing font. You will see a box for each record, with check marks only on the shipped records, or whatever your condition is. You can also use other graphic fonts like Webdings, Symbol, Map Symbols, Vacation MT, etc. This gives you hundreds of symbols to pick from, as long as you know the font and the ASCII number of the symbol that you want.

To see all the symbols you have available, open up the windows "Character Map" program. This is usually in your start menu somewhere around "Programs->Accessories->System Tools". If not there, you can search for Charmap.exe and run it. This little program shows all of your fonts and the symbols that you have available in each. Here is an example of transferring a symbol to your report without knowing the number.

1) In CharMap, select the "symbol" font. Locate the bold heart in the lower right.

2) Single-click on it to magnify it.

3) Click the "Select" then the "Copy" buttons at the bottom of the window.

4) Switch to your report and open one of your If-Then-Else formulas that is character.

5) Paste the symbol in as the THEN or ELSE value (it will be copyright symbol for now).

5) Put quotes around the copyright symbol and save the formula.

6) Place the formula on the report, and select the "Symbol" font.

It should print bold hearts on some records when you preview the report.

I prefer to use the CHR function, as in my original example. But, this requires the extra step of finding the ASCII code for the symbol. One way is to paste your symbol from the character map into a formula with the ASC() function. This way Crystal will display ASCII number for you. The following formula:

ASC('©')

would display the ASCII value 169 when previewed. Therefore, the following formula:

CHR(169)

would give you a heart, or a copyright symbol, or possibly something else, based on the font selected.

Source

Hope this helps

Regards

Jehanzeb