Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
arethaking
Creator II
Creator II

What is chr(39)? Why it is

This is the code.

Please explain.

LET vTrendStart = '=Date(YearStart(Addmonths(Max(MonthYear), -12)), ' & chr(39) & 'MMMYY' & chr(39) & ')';

LET vTrendEnd = '=Date(MonthStart(Max({<_History = {1}>} MonthYear)), ' & chr(39) & 'MMMYY' & chr(39) & ')';

1 Solution

Accepted Solutions
trdandamudi
Master II
Master II

Chr(39) means single quote. If you use single quote directly in the LET statement it will not evaluate properly and that is the reason you use Chr(39). Hope this helps...

View solution in original post

3 Replies
trdandamudi
Master II
Master II

Chr(39) means single quote. If you use single quote directly in the LET statement it will not evaluate properly and that is the reason you use Chr(39). Hope this helps...

arethaking
Creator II
Creator II
Author

Thanks for the answer.could you explain how it will works for the above syntax.

santiago_respane
Specialist
Specialist

Hi,

first of all it is good to know what the CHR function does... It returns the string character corresponding to its number.

Examples:

CHR(13) returns a carriage return

CHR(65) returns A (Capital A)

CHR(64) return @ (At simbol)

CHR(39) returns ' (single quote)

Character codes can be found in multiple sites (Example: http://www.asciitable.com/ )

And the reason why it is being used in that expression is that as you are trying to use single quotes insinde an expression already enclosed by single quotes, so the in the Let statement wont be evaluated properly.

Hope this helps.

Kind regards,