Examples: Functions for Table-Type Projects


See working examples of functions that work with table data in NLG Studio projects of the types Describe Each Row, Describe the Table, and Describe Each Row in Context.

Enter your Studio email below to access this sample


Functions for Table-Type Projects

This sample project demonstrates how to use functions for use with table projects (Describe Each Row, Describe the Table, and Describe Each Row in Context).

Note: Many of these functions also work in JSON projects (Describe a JSON Object) — see the ATL Reference for details.

Rather than illustrating a specific use case, this sample project helps you understand how to use the functions by providing working examples. Functions are demonstrated by showing the ATL that is needed to call each function, both as readable text and as a working, executable example.

This sample organizes functions into different categories. Each category is a separate script within the project as follows:

 

Functions that return regions of a table

  • cell
  • cellInRegion
  • columns
  • columnsInRegion
  • max
  • min
  • rows
  • rowsInRegion
  • sortedColumns
  • sortedColumnsInRegion
  • sortedRows
  • sortedRowsInRegion

Functions that return a list

  • concat
  • columnNames
  • rowNames
  • unique

Functions that return or transform table cells

  • asBoolean
  • asNumber
  • asString
  • asTable
  • value

Formatting functions

  • currency
  • formatNumber
  • now
  • today

Language functions

  • countable
  • gender
  • inflectNoun
  • inflectVerb
  • list
  • numToWords
  • pronoun

Math functions

  • abs
  • absDiff
  • averageVal
  • diff
  • direction
  • div
  • maxVal
  • minVal
  • percentage
  • percentageChange
  • percentageChangeAcrossSeries
  • power
  • product
  • root
  • round
  • sign
  • sum
  • totalVal

Text functions

  • charAt
  • contains
  • decodeHtml
  • encodeHtml
  • endsWith
  • indexOf
  • initCap
  • joinStrings
  • len
  • lower
  • split
  • startsWith
  • substitute
  • substring
  • titleCase
  • trim
  • upper

Higher-order or variable-manipulation functions

  • filter
  • forAll
  • forAllCellsByColumn
  • forAllCellsByRow
  • forAllColumns
  • forAllRows
  • map
  • pairwiseMap
  • reduce
  • top
  • topColumns
  • topRows

Sorting functions

  • sort
  • sortByColumn
  • sortByColumnNumbers
  • sortByColumnNumbersReverse
  • sortByColumnStrings
  • sortByColumnStringsReverse
  • sortByRow
  • sortByRowNumbers
  • sortByRowNumbersReverse
  • sortByRowStrings
  • sortByRowStringsReverse
  • sortNumbers
  • sortNumbersReverse
  • sortStrings
  • sortStringsReverse

Other advanced functions

  • numColumns
  • numRows
  • zip
  • zipWithIndex