Order of Functions

Doc Auto Team
Doc Auto Team
  • Updated

In order to filter and capture the right information in your document, functions should be ‘stacked’ in a specific order. Although there are some nuances as to how to structure specific filters and functions to get the desired result, consider the following as a guideline:

Screen

 

1. Filtering

filter

This function refines the data and includes pre-defined as well as ad hoc filters. For more information, please see the article on Using Pre-defined and Ad Hoc Filters to Refine Data

uniqBy

This function removes duplicates once you have filtered the data appropriately. For more information, please see the article on Removing Duplicates with uniqBy.

2. Grouping

groupBy

This function creates sub-groups of data based on a common variable. For more information, please see the article on Creating Sub-Groups of Data with GroupBy.

lookup

This function uses a common unique variable that exists in different collections to link the two together. For more information, please see the article on Lookup Another Collection.

3. Sorting

orderBy_B / orderBy_A

These functions sorts data, alphabetically or numerically, in ascending or descending order. For more information, please see the article on Sorting and Ordering Data.

4. Operations

count

This function counts the relevant data once it has been filtered and sorted. A simple count function will output a numerical value, but may also be used with logic statements or math operations. For more information, please see Counting Data on counting, Logic & Conditions on the use of count logic, and Math Operations through Document Coding on using count in performing math operations.

sum

This function sums up number-type data to provide an aggregate amount. For more information, please see the article Getting an Aggregate Amount using Sum.

limit

This function limits the amount of data output in a loop. For more information, please see the article on Limiting Data Output in a Collection.

grab

This function fetches data from a specific numerical index position. For more information, please see the article on Grabbing Specific Data.

 

5. Arranging

roundNum

This function rounds up number-type data to a specified decimal point. For more information, please see the article on Formatting Numbers: roundNum, commaSeparate, numberConvert.

toSentence

This function takes single variables in a collection loop and formats them into sentence structure format. It is only available with single variable construction. For more information, please see the article on Listing Variables in Sentence Format.

time

This function formats time and dates as they need to appear in different documents. The default will show up in ISO format (YYYY-MM-DD). For more information, please see the article on Formatting Dates

6. Formatting

upper / lower / firstCase

These functions format the case of the variable, in either upper, lower, or first case. For more information, please see the article on Formatting Text: upper, lower, firstCase.

numberConvert

This function converts number-type data into written word format. For more information, please see the article on Formatting Numbers: roundNum, commaSeparate, numberConvert

commaSeparate

This function formats numbers with a comma separator in the thousandths and millionths places, etc. For more information, please see the article on Formatting Numbers: roundNum, commaSeparate, numberConvert