Upper - script and chart function
Upper() converts all the characters in the input string to upper case for all text characters in the expression. Numbers and symbols are ignored.
Syntax:
Upper(text)
Return data type: string
Argument | Description |
---|---|
text | The string to evaluate. |
Example | Result |
---|---|
Upper( ' abcD' ) | Returns ABCD |
Example - Upper fundamentals
Overview
Open the Data load editor and add the load script below to a new tab.
The load script contains:
-
One field in the data table called InputText.
A dataset which is loaded into a data table called Example.
Load script
Example:
Load * inline [
InputText
rHode iSland
washingTon d.C.
new york
];
Results
Load the data and open a sheet. Create a new table and add this field as a dimension:
-
InputText
Create the following calculated dimension:
-
=Upper(InputText), to convert all the characters in the InputText field to uppercase.
InputText | Upper(InputText) |
---|---|
new york | NEW YORK |
rHode iSland | RHODE ISLAND |
washingTon d.C. | WASHINGTON D.C. |
The output of the Upper function converts all values to uppercase.
The following code shows how to use the function in a load script.
Load
String,Upper(String)
Inline
[String
rHode iSland
washingTon d.C.
new york];
String | Upper(String) |
---|---|
rHode iSland | RHODE ISLAND |
washingTon d.C. | WASHINGTON D.C. |
new york | NEW YORK |
Example - Upper scenario
Overview
A dataset contains ISO country codes and country names in various formats, such as all lowercase, all uppercase, or mixed case. The objective is to clean the data so that each country code and name are formatted to use uppercase.
Open the Data load editor and add the load script below to a new tab.
The load script contains:
-
The following fields in the data table:
-
ISO CountryCode
-
CountryName
-
A dataset which is loaded into a data table called Example.
Load script
Country:
Load * inline [
ISO_CountryCode, CountryName
gbr, United kingdom
Ind, india
CAN, Canada
Are, United arab emirates
];
Results
Load the data and open a sheet. Create a new table and add these fields as dimensions:
-
ISO_CountryCode
-
CountryName
Create the following calculated dimensions:
-
=Upper(ISO_CountryCode), to create a column of country codes that use all uppercase characters.
-
=Upper(CountryName), to create a column of country names that use all uppercase characters.
ISO_CountryCode | CountryName | Upper(ISO_CountryCode) | Upper(CountryName) |
---|---|---|---|
Are | United arab emirates | ARE | UNITED ARAB EMIRATES |
CAN | Canada | CAN | CANADA |
gbr | United Kingdom | GBR | UNITED KINGDOM |
Ind | india | IND | INDIA |
The Upper function has converted all country codes and country names to use uppercase characters.
Example - Upper advanced scenario
Overview
Using the same dataset as the previous scenario, this example combines country name and country code and formats these strings using the Capitalize and Upper functions.
Result
Load the data and open a sheet. Create a new table and add these fields as dimensions:
-
ISO_CountryCode
-
CountryName
Create the following calculated dimension:
-
=Capitalize(CountryName) & ' (' & Upper(ISO_CountryCode) & ')', to create a new dimension that concatenates CountryName and ISO_CountryCode and formats the country names to use title case and the country codes to use uppercase.
ISO_CountryCode | CountryName | Capitalize(CountryName) & '(' & Upper(ISO_CountryCode) & ')' |
---|---|---|
Are | United arab emirates | United Arab Emirates (ARE) |
CAN | Canada | Canada (CAN) |
gbr | United Kingdom | United Kingdom (GBR) |
Ind | india | India (IND) |