27 February, 2017

Tableau Formatting Literals

Formatting Literals

When you are using functions you will sometimes want to use literal expressions to represent numbers, strings, dates, and more. A literal expression signifies a constant value that is represented “as is.” For example, you may have a function where your input is a date. Rather than just type “May 1, 2005”, which would be interpreted a a string, you would type #May 1, 2005#, which is equivalent to using a date function to convert the argument from a string to a date (refer to Date Functions). You can use numeric, string, date, boolean, and Null literals. The way to format each of these literals is described below.

Numeric Literals

A numeric literal is written exactly like you usually write numbers. If you want to input the number one as a numeric literal you would type 1. Subsequently, if you want to input the number 3.1415 as a numeric literal you would type 3.1415.

String Literals

A string literal can be written either using single quotations or double quotations. If your string has a single or double quotation within it, simply type the symbol twice. For example, if you wanted to input the string “cat” as a string literal you could type ‘cat’ or “cat”. Additionally, if you want to type the string “She’s my friend.” as a string literal you could type ‘She’’s my friend.’ or “She’s my friend.”

Date Literals

Date literals are signified by the pound symbol (#). If you wanted to input the date “August 22, 2005” as a literal date you would type #August 22, 2005#.

Boolean Literals

Boolean literals are written as either true or false. If you wanted to input “true” as a boolean literal you would type true.

Null Literals

Null literals are written simply as Null. If you wanted to input “Null” as a Null literal you would type Null.

Details (Officials)

No comments:

Post a Comment