#
Functions Node

There are many scenarios in which it is needed to perform more advanced functions and logical statements that require a little bit more of coding. For these cases, we have the Functions node! Using the Functions node you can perform:

**Number Functions**: These are the mathematical/ arithmetical calculations in which you can add, subtract, divide, or multiply numeric fields. It is also possible returning the minimum (LEAST) or maximum (GREATEST) value for a specific field. Furthermore, you can also calculate the Ceil, Floor, Round, or the absolute value of specific fields.- The floor value is a type of rounded value that gives you the nearest integer down. For example, the floor of 5.21 is 5.
- The ceiling value is a type of rounded value that gives you the nearest integer up. For example, the ceiling of 5.21 is 6.
- The round function returns the value of a number rounded to the nearest integer which can be either up or down. For example, the rounded value of 5.21 is 5.
- The absolute value often denoted as |x|, is the distance of a number from 0. For instance, the absolute value of 5 is 5, and the absolute value of -5 is also 5.

**Text Functions**: These are functions used to manipulate text, or string fields. A few examples are trimming text, changing it into upper or lower cases, replacing text, splitting, and so on.**Boolean Functions**: These are functions that follow certain binary conditions and returns either True or False. You can use with the other function types above to create very powerful and complex queries. A few example of boolean functions or operators are AND, OR, NOT, GREATER_THAN, LESS_THAN, CONTAINS, etc.**Date + Time Functions**: Finally, there are the date and time related functions. These allow you to subtract dates, truncate date values and cast data types to convert it to a datetime or timestamp, for example.

Another usage for the node is to join columns together or add extra text to a column, displaying them in a new column or overwrite an existing column. For example, you could create a new column "full_name" that concats the columns "name" and "surname". Likewise, you may just create a new column with the same values in every row by just typing the text in between quotation marks.

Note: *In order to use the Model feature you already should have already imported data sources into Y42.*

# Adding the Functions Node to Your Model

- In the
**Model**tab, click**Add**... Name your new data model and choose a privacy level. - Create at least one input table by dragging and dropping the
**Input**field into your data model structure. Choose a data table by clicking on it, then click**Save**. - Drag and drop a
**Functions**node close to the Input field. They will automatically connect. Alternatively, you can manually link the nodes by dragging and dropping a line:

# Setting Up Your Functions Node

- Click on the
**Functions**node to apply the node settings. On this node, besides of the interface for setting up your node, or creating your functions, you have access to the documentation for each available function on the right side.

- You can choose to create a new column by typing it into the
**Target Column**box or overwrite an existing column by selecting it from the menu. - Choose the function or the combination of functions you want to apply in your data calling the columns by using the
*@*symbol. - When you're done, you can check the transformation by clicking
**Output**. If you're satisfied, click**Save**.

Once you're done extracting the minimum or maximum of your columns, you can either perform further transformations or, if you want to export the new data table, click **Commit Model**.