50 likes | 117 Views
The term u201cstringu201d refers to a type of data being used in software programming. String Functions are used to manipulate a string or text data used in software programming.
E N D
Tableau String Functions The term “string” refers to a type of data being used in software programming. String Functions are used to manipulate a string or text data used in software programming. Here we discuss the Tableau String Functions and its uses. There are various string functions provided by Tableau to alter the string or text data. The following are the types of string functions such as, LEN, LTRIM, CONTAINS, MID, ASCII, CHAR, REPLACE and so on. To understand these string functions in detail we will discuss them with examples. ASCII Function– In this Tableau function, we will find the ASCII value for the first character. The syntax for the tableau ASCII function is as follows; ASCII (string) Statement – Returns ASCII value for the first character. EX: ASCII (A) = 66 CHAR Function- In this function of Tableau, we will get a return character for the ASCII value given. The syntax for the tableau CHAR function is as follows: CHAR (number) Statement – Returns the character converted by ASCII value. EX: CHAR (66) = A. More details from Tableau Course LEN Function -This function of Tableau returns the string’s length. The syntax for the tableau LEN function is as follows: LEN (string) Statement – Returns the length of a string EX: LEN (“Provide”) = 7
CONTAINS Function – This function of Tableau returns a TRUE value if the exact substring exists in the original string. The syntax for the tableau CONTAINS function is as follows: CONTAINS (substring, string) Statement – The tableau function checks that the records exist in the Department column CONTAINS substring Finance or not. EX: CONTAINS (“Finance”, Department) LTRIM Function – This function of Tableau, removes the spaces from the left side of the string which is empty. The syntax for the tableau LTRIM function is as follows: LTRIM (string) Statement – This tableau function removes the spaces from the left side of the last name which is empty. EX: LTRIM (spaces) MID Function – This function of Tableau returns the substring value from the actual string. The syntax for the tableau MID function is as follows: MID (string, “start”, (length)) Statement – It works on three levels •Actual String •Index Position (start) •Length EX: MID (“tabulation”, 2) = “abulation” MID (“tabulation”, 2, 5) = “abula” Replace Function – This tableau function makes a change in the original string by replacing the substring with a new string. The syntax for the tableau REPLACE function is as follows:
REPLACE (string, substring, replaced string) Statement – •Actual String •Old String (substring) •New replaced substring EX: (department, “Finance”, “Sales”). For more info Tableau Training LEFT Function – This tableau function returns the most left character within the string. The syntax for the tableau LEFT function is as follows: LEFT (string, index character) Statement – It returns the most left character from the index position within the string. EX: LEFT (“Calculation”= 3) “Cal” LOWER Function – This tableau function changes the characters of the given string into Lower case. EX: LOWER (“Sales”) = (“sales’) UPPER Function– This tableau function is just the opposite of Lower function. It converts the characters in the string to the UPPER case. EX: UPPER (‘tableau’) = (“TABLEAU”) SPLIT Function – The tableau split function uses a limitation character to divide the sequence of a string into tokens and returns the substring from the actual string. Here the delimiter acts as a divider between the sequences of characters. Syntax: SPLIT (string, ‘-‘or delimiter, token (1, 2, 3…)) EX: SPLIT (‘j-k-L-m’, ‘-‘, 3) = ‘L’ SPLIT (‘j-k-L-m’, ‘-‘,‘-3’) = “k
How to find text in a Tableau string: - Here we learn how tableau find text in string with some example. It is very simple to find a text within a string using tableau function. In this context, we use the CONTAINS tableau function. EX: Calculation - CONTAINS (Employee Name), ‘DAVID’) After entering the above function, we will find the employees with the name having ‘DAVID” in the group. This function helps to find a particular name or any item from the stock list by writing simple string formulae. Not only restricted to find a name or stock item, it can find any character or number within a large number of data. Conclusion– In this tutorial, we got the knowledge of different tableau string functions and their usage like, ASCII, CHAR, LEN, LEFT, CONTAINS, MID, LEFT, UPPER, LOWER, SPLIT, REPLACE, etc. It will give an overview of the beginners who want to learn Tableau functions. It will be easy to learn these functions which need a basic idea about the strings and their usage. Strings are mostly used in programming languages like C, C++, and JAVA, etc. Thus, one can learn tableau and its functions having some programming knowledge. To get in-depth knowledge, enroll for a live free demo on Tableau Online Training