on ‎2008 Oct 22 3:49 PM
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?
Request clarification before answering.
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.
Hope this helps
Regards
Jehanzeb
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
| User | Count |
|---|---|
| 8 | |
| 8 | |
| 7 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.