Chr - script and chart function
Chr() returns the Unicode character corresponding to the input integer, also known as a code point.
Syntax:
Chr(int)
Return data type: string
Arguments
int
|
The integer to evaluate. |
Example: Chart expressions
Chr(65)
|
Returns the string A |
Chr(163)
|
Returns the string £ |
Chr(35)
|
Returns the string # |
Example - Chr fundamentals
Overview
Open the Data load editor and add the load script below to a new tab.
The load script contains:
Load script
Example:
Load * inline [
InputInt
65
163
35
];
Results
Load the data and open a sheet. Create a new table and add this field as a dimension:
Create the following measure:
Results table
InputInt |
Chr(InputInt) |
35 |
# |
65 |
A |
163 |
£ |
The first row returns the string # as that is the Unicode character that corresponds to the value of 35.
The second row returns the string A as that is the Unicode character that corresponds to the value of 65.
The third row returns the string £ as that is the Unicode character that corresponds to the value of 163.
Example - Chr scenario
Overview
This example shows how to use the Chr function to create a bullet list of the text strings in a text object.
Results
Open a sheet. Create a new text object, and then add the following code to a measure:
The output is derived in the following way :
-
Chr(149) returns a bullet point (•).
-
Chr(10) inserts a line break (newline) between the items.
-
The ampersand (&) is a string concatenation operator that concatenates the individual pieces of text into a single text string.