Data Types

Wordsmith will look at your data (either via upload or the API), and determine whether the data is a Number, Text, List, Date, Time, DateTime, or True/False. These distinctions affect the formatting options you have for that data and the functions you're able to use in Branches, so it's important that they are categorized correctly.

Change Data Types

You can change how all of your data is classified by visiting the Data tab in a Template and clicking "Edit Data Types." Once you've done that you'll be taken to the page below, where you can change the data type in the middle column. When you're done, click "Save Types", and open up your Template again. The data type should be updated and you'll have different formatting and function options available.

1000

You can also get there from the Project page using the dropdown list next to the name of your CSV file.

1000

Tableau Integration

If you're using the Wordsmith Tableau integration, you can change the data types of each Data Variable in a calc on the Calculate page. Open up the calc, and you'll see an icon next to each column header in the table indicating the type of data. If you want to change it, click on the arrow next to the column header and select 'Change calc output type'. You'll see a drop-down of all the data types. Changing the data type will change the formatting options you see when inserting that Data Variable into your Template and the operators you can use in your Branches.

1252

Numbers

Wordsmith gives you a lot of formatting options for numbers. And as you select the different options in the drop-down list, you'll see the displayed number update based on what you choose.

1908
  • Choose the number of decimal places.
  • Include or exclude commas.
  • Write an ordinal number.
  • Convert to an absolute value in case you have any negative values in your CSV file (like percent change).
  • Multiply by 100, especially useful for decimal values in your CSV that you want to be represented as a percentage i​n your content.
  • Put parentheses around negative numbers.
  • Insert a plus symbol (+) in front of the number.
  • Write out numbers as text if they're under 10 (i.e. one, two, three). And choose how you want that text capitalized.
  • Write out all numbers as text (i.e. one, two, ten, fifty). And choose how you want that text capitalized.
  • If you have large numbers in your data (millions, billions, trillions), you can shorten them to 5 billion. You can even choose the number of decimals displayed for those shortened numbers.

If you choose to include decimal places, you'll have the option to strip trailing zeros.

500

In this example, 3 decimal places will be written unless there are trailing zeros. In that scenario, the number of decimal places will be fewer.

📘

PRO TIP

Combine formatting options to display your numbers exactly how you want to. For example, adding ordinal ending and writing out number less than 10 will mean your numbers are written as first, second, third, etc. all the way up to ninth.

When using numbers in conditions, you can use all of the comparison and math operators: greater than, less than, equal to, plus adding, subtracting, etc.

Text

You can change the capitalization for data that is text. Use this tool as a way to normalize any data you might have that isn't all uniformly capitalized. There are currently 5 different ways you can format your text variables:

  • Keep as-is: This is the default setting. This will leave your data unchanged.
  • First word: This will capitalize the first letter in your data, leaving the rest of the data unchanged.
  • Each Word: This will capitalize the first letter of each word in your data.
  • EACH LETTER: This will change all letters in your data to uppercase letters.
  • no letters: This will change all letters in your data to lowercase letters.
1295

For Text data, you can use operators like equals and does not equals for an exact match, or includes and excludes for a partial match.

Lists

A list is a series of values separated by a comma within one cell of your CSV file or one data value passed to the Wordsmith API.

970

The Data Variable top_neighborhoods would be considered a List in Wordsmith.

You can choose how you want to capitalize the text or display the numbers in a list, how you want to separate the items, and even what items to write.

1030

List Formatting

Choose how you want to group the values in the list by selecting the conjunction 'and' or 'or', or if you don't want to include a conjunction, select 'none'. You can also choose to include an oxford comma.

List Settings

You have control over how you want to write the values in the list - you can pull out individual values by their order and even re-sort the order.

  • None: Values in the list remain unchanged from how they are in the data.
  • First: Choose the number of values you want inserted in the Template starting at the beginning of the list. Selecting First 1 Item will write just the first value in the list, selecting First 2 Items will write the first and the second values in the list, and so on.
  • Last: Choose the num of values you want inserted in the Template starting at the end of the list.
  • Nth: Choose one specific value by its order in the list. If you wanted to just insert the second value in a list, you would select Nth 2nd Item.
  • Sort: Re-order the values in the list regardless of their order in the data. You can sort Ascending or Descending and then choose None, First, Last, or Nth based on that new order. Sorting will work for text and number values within a list.

Lists of Text Items

If the items in the list are text, you can choose the casing. For example, if you're starting a sentence with a list Data Variable, you may want to set the letter casing as 'Capitalize first letter'.

914

Some formatting options will also allow you to format the conjunction.

901

The "EACH LETTER" formatting option will give you the option to also capitalize "AND" or "OR"

Lists of Number Items

If the items in the list are numbers, you'll see all of the available number formatting options, like setting the decimal places.

992

You can use all of the same operators for lists that you can with text, plus the includes and excludes functions.

Dates, Times, and DateTimes

Dates

Wordsmith recognizes the most common date formats from Excel and Google Sheets (MM/DD/YY or MM/DD/YYYY) that are uploaded to the Wordsmith Project or passed via the API.

902

There are a lot of formatting options available for dates, but if you don't see the specific way you want to represent your data, try inserting the Data Variable twice and formatting each one differently.

500

To write "Monday, November 7th, 2016", the date is inserted twice: the first time formatted to be the day of the week and the second time formatted to be the full date.

You can use Get functions to pull out one part of a date (like the day of the week), Between functions to compare the time between two dates, and the Ahead/Ago functions to add or take away time from a date.

Times

In addition to dates, Wordsmith can recognize units of time as well. Wordsmith can support time up to the seconds unit in both 12 and 24 hour formats (10:59 PM or 22:59).

306

Wordsmith will recognize all of these formats as Time data.

And you can reformat your Time data to look like any of these options when written in your narratives.

861

You can compare Time Data Variables to each other or to a new value. When comparing to a new value, make sure to put the value in quotes.

1458

For example, you could use time data to help describe the time of day when a bus might arrive. This rule will be true if arrival_time is after 3pm.

Or you could compare two time variables to each other.

DateTimes

Along with Dates and Times, Wordsmith also recognizes DateTimes. DateTimes can be formatted just like Dates and Times.

686

Wordsmith will recognize a combination of any Date and Time formats for Datetimes.

Just like with Dates, you can us you can use Get functions to pull out one part of a date, like the day of the week, with DateTimes. Between functions to compare the time between two dates (i.e. how many days between two dates) and the Ahead/Ago functions to add or take away time from a date will work with DateTimes.

📘

Timestamps in your data will be automatically recognized as a DateTimes in Wordsmith.

Custom Formatting: Dates, Times, & DateTimes

In addition to standard formatting for Date, Times and DateTimes shown in the sections above, Wordsmith provides you the ability toggle on or off custom formatting for all 3 of these data types. Custom Dates, Times, and DateTimes allow you the highest possible level of customization for your detailed Dates, Times, and DateTimes data.

Custom formatting uses strings of tokens and then replaces them with the corresponding values. Here is an example using 01/01/98 23:59:59 as a DateTimes data variable:

1768

You can see the tokens used in this example in the table below.

TokenOutput
MonthM1 2 ... 11 12
 Mo1st 2nd ... 11th 12th
 MM01 02 ... 11 12
 MMMJan Feb ... Nov Dec
 MMMMJanuary February ... November December
QuarterQ1 2 3 4
 Qo1st 2nd 3rd 4th
Day of MonthD1 2 ... 30 31
 Do1st 2nd ... 30th 31st
 DD01 02 ... 30 31
Day of YearDDD1 2 ... 364 365
 DDDo1st 2nd ... 364th 365th
 DDDD001 002 ... 364 365
Day of Weekd0 1 ... 5 6
 do0th 1st ... 5th 6th
 ddSu Mo ... Fr Sa
 dddSun Mon ... Fri Sat
 ddddSunday Monday ... Friday Saturday
Day of Week (Locale)e0 1 ... 5 6
Day of Week (ISO)E1 2 ... 6 7
Week of Yearw1 2 ... 52 53
 wo1st 2nd ... 52nd 53rd
 ww01 02 ... 52 53
Week of Year (ISO)W1 2 ... 52 53
 Wo1st 2nd ... 52nd 53rd
 WW01 02 ... 52 53
YearYY70 71 ... 29 30
 YYYY1970 1971 ... 2029 2030
 Y1970 1971 ... 9999 +10000 +10001
Week Yeargg70 71 ... 29 30
 gggg1970 1971 ... 2029 2030
Week Year (ISO)GG70 71 ... 29 30
 GGGG1970 1971 ... 2029 2030
AM/PMAAM PM
 aam pm
HourH0 1 ... 22 23
 HH00 01 ... 22 23
 h1 2 ... 11 12
 hh01 02 ... 11 12
 k1 2 ... 23 24
 kk01 02 ... 23 24
Minutem0 1 ... 58 59
 mm00 01 ... 58 59
Seconds0 1 ... 58 59
 ss00 01 ... 58 59
Fractional SecondS0 1 ... 8 9
 SS00 01 ... 98 99
 SSS000 001 ... 998 999
 SSSS ... SSSSSSSSS000[0..] 001[0..] ... 998[0..] 999[0..]

True/False

True/False data, also called Booleans, is a type of data with only two options: True or False. Wordsmith will recognize data as True/False if all of the data for that Data Variable is either "true" or "false", "t" or "f", "yes" or "no", or "y" or "n".

An example of True/False data could be features of a product. Below is product data for different TVs. Wordsmith will recognize the wifi_capable Data Variable as True/False data. Y/n and yes/no are also recognized as True/False data, so smart_tv and hdmi_port would be True/False data types, as well.

680

This is product data for different TVs. Wordsmith will recognize the wifi_capable Data Variable as True/False data. Y/n and yes/no are also recognized as True/False data, so smart_tv and hdmi_port would be True/False data types, as well.

You probably won't need to format True/False data, and will more likely be using it in Branches. Using the data in the example above, the Branch rules would be "wifi_capable = true", "smart_tv = true", or "hdmi_port = true".

Even if your data doesn't include "true" and "false", Wordsmith will recognize any "true" as TRUE. So "yes" is TRUE, "y" is TRUE, and "t" is TRUE. And the alternative works for "false": "no" is FALSE, "n" is FALSE, and "f" is FALSE. Because of that, you can use any of the functions below in your Branch and they will all mean the same thing.

781

If you would like to use false as a branch option, you would write "= false" in the Branch rule.

1392