# Function

## **Introduction**

This document outlines the integration between Autom Mate and the Function Feature, explaining how Autom Mate enhances functionality through predefined functions.

The collaboration between Automate and the Function Feature enables users to leverage predefined functions seamlessly, enhancing workflow capabilities and productivity.

***

## **What is the Function Feature?**

**Overview of the Function Feature:** The Function Feature provides users with a library of predefined functions that can be easily integrated into actions within Automate.

{% hint style="info" %}

### **Key Features**

* **Predefined functions for enhanced functionality**
* **Easy integration within actions**
* **Streamlined workflow automation**
  {% endhint %}

***

## **Autom Mate Integration with the Function Feature**

**Overview of Integration:** Autom Mate seamlessly integrates with the Function Feature, allowing users to incorporate predefined functions into their workflow actions.

> **Examples of Automated Tasks:**
>
> * Utilizing predefined functions for data manipulation
> * Implementing conditional logic using predefined functions

***

### **How To Use Feature**

The Function Feature allows users to leverage predefined functions within their workflow actions. This action facilitates enhanced functionality and automation capabilities within Automate workflows.

**Usage**

{% stepper %}
{% step %}
Navigate to the **Message or Command Space**

Go to the message or command area within the action control center.
{% endstep %}

{% step %}
Write **'fn.'**

Type "fn." to open the list of predefined functions.
{% endstep %}

{% step %}
Select a Function

Choose the required function from the dropdown menu that appears.
{% endstep %}
{% endstepper %}

{% hint style="success" %}

#### **Inputs**

Function parameters may vary based on selected function.
{% endhint %}

{% hint style="danger" %}

#### **Outputs**

Results or responses generated by the selected function.
{% endhint %}

<figure><img src="https://4222414448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMAf5diEa8kgXDA6h47Cu%2Fuploads%2FMs4DQ7EBLNmF7k5hpnkI%2FFN.gif?alt=media&#x26;token=a6242f75-2b3c-4469-b634-5919a96542de" alt=""><figcaption></figcaption></figure>

***

## Usage of Each Functions

This guide explains functions that will help you perform various data manipulation operations. Each function performs a specific task and facilitates your data processing workflow.

Functions are crucial building blocks that contribute to making your data modular and comprehensible. A function is an independent and reusable code block that accomplishes a specific task. This block is grouped under a name and, when called, executes a particular operation.

{% hint style="warning" %}
**Functions properties can be used in all input fields within Autom Mate.**
{% endhint %}

***

## Data Manipulation Functions

In this section, you will find functions used to perform various manipulation operations on text data. These functions assist you in editing, transforming, and checking your text data

***

### **UpperCase**

This function is used to convert a text entirely into uppercase. You can use the function as follows:

<pre class="language-python"><code class="lang-python"><strong>fn.UpperCase(text)
</strong></code></pre>

***

### **LowerCase**

This function is used to convert a text entirely into lowercase. You can use the function as follows:

```python
fn.LowerCase(text)
```

***

### **Capitalize**

This function is used to capitalize the first letter of a text. You can use the function as follows:

```python
fn.Capitalize(text)
```

***

### **Replace**

This function is used to replace a specific character or string of characters in a text with another character or string. You can use the function as follows:

```python
fn.Replace(text|old_str|new_str)
```

***

### **Contains**

**T**his function is used to check whether a text contains a specific character or string of characters. For example, if **"text"** contains the target\_str, it returns **"True"**; otherwise, it returns **"False."**  You can use the function as follows:

```python
fn.Contains(text|target_str)
```

***

### **RemoveHTML**

This function is used to remove HTML tags from a text. For example:

<figure><img src="https://4222414448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMAf5diEa8kgXDA6h47Cu%2Fuploads%2F3PVbSwkRk1BkO5To7m2V%2FremoveHTML.gif?alt=media&#x26;token=86064210-43cc-40f8-a267-bcf1db88e4e8" alt=""><figcaption></figcaption></figure>

***

## **Math Functions**

Mathematical functions are specialized functions that enable you to easily perform various mathematical calculations. These functions encompass a wide range of mathematical operations, such as performing basic mathematical operations on numbers.

***

### **Sum**

This function is used for basic addition, performing mathematical calculations. You can use the function as follows:

<pre class="language-python"><code class="lang-python">fn.Sum(number1|number2|decimal)
<strong>fn.Sum(15|5|3) = 20,000
</strong></code></pre>

***

### **Difference**

This function is utilized to calculate the difference between two numbers. \
You can use the function as follows:

```python
fn.Difference(number1|number2|decimal)
fn.Difference(15|5|2) = 10,00
```

***

### **Multiply**

This function is employed for multiplying two numbers. You can use the function as follows:

<pre class="language-python"><code class="lang-python">fn.Multiply(number1|number2|decimal)
<strong>fn.Multiply(3|4|4) = 12,0000
</strong></code></pre>

***

### **Divide**

This function is used to divide one number by another. You can use the function as follows:

<pre class="language-python"><code class="lang-python">fn.Divide(number1|number2|decimal)
<strong>fn.Divide(8|2|1) = 4,0
</strong></code></pre>

***

### **Ceil**

This function rounds the input number to the next greater integer or float. You can specify the precision of the decimal digits. You can use the function as follows:

```python
fn.Ceil(1234.567|0) OR fn.Ceil(1234.567) = 1235
fn.Ceil(-1234.567) = -1234
fn.Ceil(1234.567|2) = 1234.57
fn.Ceil(1234.567|-2) = 1300
```

***

### **Average**

This function takes the average of the entered numbers. You can specify the precision of the decimal digits. You can use the function as follows:

```python
fn.Avg(<number 1>|<number 2>|<number n>|<decimal place>)
fn.Avg(10|15|5) OR fn.Avg(10|15|5|precision:0) = 10
fn.Avg(10|15|5|precision:2) = 10,00
fn.Avg(12.34|56|78|precision:2) = 48.78
fn.Avg(12.34|56|78) = 48
```

***

### **Mod**

This function divides left hand operand by right hand operand and returns the remainder.\
You can use the function as follows:

```python
fn.Mod(<number 1>|<number 2>|<decimal place>)
fn.Mod(10|15) OR fn.Mod(10|15|0) = 10
fn.Mod(15|10|2) = 5,00
fn.Mod(12.34|9|0) = 3
fn.Mod(12.34|9|2) = 3.34
```

***

### **Power of**

This function takes two operands: the left-hand operand is the base, and the right-hand operand is the exponent. It multiplies the base by itself as many times as indicated by the exponent and returns the result of that operation. You can use the function as follows:

```python
fn.PowerOf(<number>|<exponent>|<decimal place - optional>)
fn.PowerOf(2|3|0) OR fn.PowerOf(2|3) = 8
fn.PowerOf(9|1.5) = 27.00
fn.PowerOf(9|1.5|0) = 27
fn.PowerOf(5|-1.2) = 0.14495593273554
```

***

### **Absolute**

This function returns the absolute (positive) value of a number. You can use the function as follows:

```python
fn.Abs(<value>|<decimal place>)
fn.Abs(123|0) OR fn.Abs(123) = 123
fn.Abs(-123) = 123
fn.Abs(-123|2) = 123.00
fn.Abs(-123.45|2) = 123.45
```

***

### **Round**

This function returns a value with a specified number of decimal places. Function rounds off a numerical value. You can use the function as follows:

```python
fn.Round(<value>|<precision>)
fn.Round(1234.567|0) OR fn.Round(1234.567) = 1235
fn.Round(-123.456) = -123
fn.Round(1234.567|2) = 1234.57
fn.Round(1234.567|-2) = 1200
```

***

### **Is Even**

This function checks the integer input and returns true if it is an even number. You can use the function as follows:

```python
fn.IsEven(<value>)
fn.IsEven(1234) = true
fn.IsEven(123) = false
```

***

### **Is Odd**

This function checks the integer input and returns true if it is an odd number. You can use the function as follows:

```python
fn.IsOdd(<value>)
fn.IsOdd(1234) = false
fn.IsOdd(123) = true
```

***

### **Floor**

This function rounds the input number to the next smaller integer or float. You can specify the precision of the decimal digits. You can use the function as follows:

```python
fn.Floor(<value>|<precision>)
fn.Floor(1234.567|0) OR fn.Floor(1234.567) = 1234
fn.Floor(-1234.567) = 1235
fn.Floor(1234.567|2) = 1234.56
fn.Floor(1234.567|-2) = 1200
```

***

### **To Float**

This function converts data to a float (number) type. You can use the function as follows:

```python
fn.ToFloat(<value>|<decimal place>)
fn.ToFloat(12|1) OR fn.ToFloat(12) = 12.0
fn.ToFloat(-12|2) = -12.00
fn.ToFloat(1234.567|2) = 1234.56
```

***

### **To Integer**

This function converts data to an integer type. You can use the function as follows:

```python
fn.ToInt(<value>)
fn.ToInt(1234.567) = 1234
```

***

### **To String**

This function converts data to a string (text) type. You can use the function as follows:

{% hint style="danger" %} <mark style="color:red;">**Default type is empty. There are only 2 types “short” and “long” related with the date format data.**</mark>
{% endhint %}

```python
fn.ToStr(<value>|<type>)
fn.ToStr(12.34) = “12.34”
fn.ToStr([1, 2, 3]) = “[1, 2, 3]”
fn.ToStr({“name”: “Autom Mate”}) = “{name: “Autom Mate”}”
fn.ToStr(2024-01-01T11:59:59.000000-07:00) = “2024-01-01T11:59:59.000000-07:00”
fn.ToStr(2024-01-01T11:59:59.000000-07:00|short) = “01 Jan 11:59”
fn.ToStr(2024-01-01T11:59:59.000000-07:00|long) = “January 01, 2024 11:59”
```

***

### **To Currency**

This function formats int/number to a currency-style. You can use the function as follows:

```python
fn.ToCurrency(<value>|<style>)

Style      | Code       | Description
Delimiter  | delimiter  | Thousands seperator
Unit       | unit       | Currency unit
Seperator  | seperator  | The seperator character for decimal places
Precision  | precision  | Decimal place
Format     | format     | The position of the unit

Default unit is $

fn.ToCurrency(123|unit:£) = £123
fn.ToCurrency(12345|unit:£|delimiter:.) = £12.345
fn.ToCurrency(12345|unit:₺|delimiter:,|format:vu) = 12,345₺
fn.ToCurrency(12345.678|delimiter:.|precision:3) = $12.345.678
```

***

### **To Phone**

This function converts string or number to a formatted phone number (user-defined). You can use the function as follows:

<pre class="language-python"><code class="lang-python">fn.ToPhone(&#x3C;value>|&#x3C;delimiter:optional>|&#x3C;format:optional>|&#x3C;c_code:optional>|&#x3C;a_code:optional>)
<strong>
</strong><strong>Style      | Code       | Description
</strong>Area Code  | a_code     | Area code
Unit       | c_code     | Country code
Format     | format     | Phone number format

Default delimiter is “ “ (whitespace)

fn.ToPhone(1234567) = 123 4567
fn.ToPhone(1234567|delimiter: -) = 123-4567
fn.ToPhone(1234567|delimiter: -|format: *** ** **) = 123-45-67
fn.ToPhone(4567890|c_code: 1|c_code_symbol) = +1 456 7890
fn.ToPhone(1234567890|c_code: 1|format:  * *** *** ** **) = 1 123 456 78 90
fn.ToPhone(1234567890|format: *** *** ** **) = 123 456 78 90
fn.ToPhone(1234567890|format: *** *** ** **|a_code) = (123) 456 78 90
fn.ToPhone(1234567890|c_code: 1|c_code_symbol|a_code) = +1 (123) 456 789
</code></pre>
