CHR and ASCII values useful in Crystal Reports, SQR, VB, Oracle.....
Recently my friend told me a requirement in Crystal Reports where he had to induce carriage return and line breaks based on a business logic which wasn't trivial. While I had to analyze the various chr options that would suit the requirement, I was searching for sites which would give me chr values in crystal reports and their functions(characters).
First of all, what is CHR?
Each character has an associated ASCII value to it. To find ASCII value of a string we will simply use the function ASCII(‘A’or ‘a’….)
If we have the ASCII value and want to find the corresponding character then we use CHR(ASCII#). For example, CHR(65) returns ‘A’. We can execure CHR(ASCII#) and ASCII('character for ascii') in ORACLE database and get the corresponding values. In Crystal Reports CHR() is replaced by CHRW().
Below are the important values which would be handy right from SQR to Crystal Reports in several occasions:
For my requirement in Crystal Reports, I wrote the required IFs and FORs in Crystal Syntax and used CHRW(32), CHRW(10), CHRW(12) and CHRW(13) to meet my customization needs. Here is the link VB_Chr_Values where CHR and ASCII values are found from 1 to 255. Few of them work only with VB or behave differently with VB.
This post sounds simple even for me; however considering the time I had vetted(after forgetting) to find the required ASCII numbers to be passed in CHRW() function in Crystal and VB syntax, I think this is worth a post that could save my time in future.
First of all, what is CHR?
Each character has an associated ASCII value to it. To find ASCII value of a string we will simply use the function ASCII(‘A’or ‘a’….)
Below are the important values which would be handy right from SQR to Crystal Reports in several occasions:
CHR values in Crystal Reports
- Character 8 - Chr(8): Backspace
- Character 9 - Chr(9): Tab (vbTab)
- Character 10 - Chr(10): Line Feed Return (vbLf)
- Character 11 - Chr(11): Shift+Enter (vbVerticalTab)
- Character 12 - Chr(12): Page Break (vbFormFeed)
- Character 13 - Chr(13): Carriage Return
- Character 14 - Chr(14): Column Break
- Character 15 - Chr(15): Shift In
- Character 32 - Chr(32): Space
For my requirement in Crystal Reports, I wrote the required IFs and FORs in Crystal Syntax and used CHRW(32), CHRW(10), CHRW(12) and CHRW(13) to meet my customization needs. Here is the link VB_Chr_Values where CHR and ASCII values are found from 1 to 255. Few of them work only with VB or behave differently with VB.
This post sounds simple even for me; however considering the time I had vetted(after forgetting) to find the required ASCII numbers to be passed in CHRW() function in Crystal and VB syntax, I think this is worth a post that could save my time in future.
Very useful, just what I was looking for.
ReplyDeleteVery useful, thanks
ReplyDeleteThank you. Very helpful.
ReplyDeleteI used the chr(9) in a formula where I needed
account# then a tab then my period delimiter.
I used
'111111'+chr(9)+'.'
but I still get a space in my tab delimited file. is there a problem with this formula?
THANKS!
doesn't look wrong in any way. I suspect the editor you are opening shows tab as a single space.
ReplyDeletethanks so much! It could be that.
Deletehow can i substitute Carriage Return with any value in peoplecode.
ReplyDeletehi @Srinivasulu Kamineni, can you elaborate please.
Delete