> For the complete documentation index, see [llms.txt](https://docs.skyone.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.skyone.cloud/english/skyone-studio/integrations/flows/data-operations/smop-small-operations.md).

# SMOP (Small Operations)

### Concept <a href="#concept" id="concept"></a>

We often need to modify a parameter before it is referenced in a flow. This happens, for example, when we are looking for a substring within a string or need to add a value to a numeric parameter. For that, there are the SMOPs (Small Operations) feature, which allows you create small operations directly in the field where the parameters are referenced. This means that every operation is executed and its result is passed as a parameter to the module.

SMOP is a data transformation feature that uses [JSONata](https://docs.jsonata.org/overview.html) to enable you to perform simple operations with flow parameters within Skyone Studio.

Some operations with parameters that we can perform in a flow using the SMOP functionality:

* Adding two numbers, such as an **offset** and a **rowCount**, when reading from a database
* Concatenate two strings or extract a pattern from one of them
* Changing the data type of a parameter, such as converting a **string** to a **number**

With SMOP, whenever a parameter is referenced, it is possible to perform small operations using the data obtained from the flow.

The ideal operations for this functionality have low complexity, so you can transform data using only one line of code. The syntax is JSONata, just like in the **Data Transformation** module.

{% hint style="success" %}
The SMOP feature is available for modules with **REST**, **Database** and **E-mail** authentication, and is present in almost all [tool modules](/english/skyone-studio/integrations/flows/tool-modules.md).
{% endhint %}

{% hint style="info" %}
SMOP is ideal for less complex data manipulations, without the need for an external response. For more complex data manipulations, also without an external response, we recommend the Data Transformation module. Finally, the Return module is ideal for more complex data manipulations that require a response to an HTTP request.
{% endhint %}

### Example Operations <a href="#example-operations" id="example-operations"></a>

The following examples describe small operations (expressions) that can be executed, whose JSONata code is limited to one line and returns only one output element, even if that element is an array:

<table><thead><tr><th width="87">E.g.</th><th>Original Parameters</th><th>SMOP expression (JSONata)</th><th align="center">New parameter</th><th>Data Type</th></tr></thead><tbody><tr><td>1</td><td><pre class="language-json"><code class="lang-json">{
<strong>  "param1" : "minha string"
</strong>}
</code></pre></td><td>$length(param1)</td><td align="center">12</td><td>number</td></tr><tr><td>2</td><td><pre class="language-json"><code class="lang-json">{
  "param1" : 10,
  "param2" : 5
}
</code></pre></td><td>param1 + param2</td><td align="center">15</td><td>number</td></tr><tr><td>3</td><td><pre class="language-json"><code class="lang-json">{
  "param1" : 10,
  "param2" : 5
}
</code></pre></td><td>param1 + param2</td><td align="center">15</td><td>number</td></tr><tr><td>4</td><td><pre class="language-json"><code class="lang-json">{
  "param1" : "Integra",
  "param2" : ".",
  "param3" : "Sky"
}
</code></pre></td><td>param1 > param2</td><td align="center">VERDADEIRO</td><td>Boolean</td></tr><tr><td>5</td><td><pre class="language-json"><code class="lang-json">{
  "param1" : "arg1 arg2 arg3"
}
</code></pre></td><td>$split(param1, " ")</td><td align="center"><pre class="language-json"><code class="lang-json">[
  "arg1",
  "arg2",
  "arg3"
]
</code></pre></td><td>Array</td></tr><tr><td>6</td><td><pre class="language-json"><code class="lang-json">{
  "param1" : "123.45"
}
</code></pre></td><td>$number(param1)</td><td align="center">123.45</td><td>Number</td></tr><tr><td>7</td><td><pre class="language-json"><code class="lang-json">{
  "param1" : [1, 2, 3],
  "param2" : 0
}
</code></pre></td><td>param1[param2]</td><td align="center">1</td><td>number</td></tr></tbody></table>

### Creating SMOPs <a href="#creating-smops" id="creating-smops"></a>

Access to the configuration of SMOPs is made during the configuration of the operation of a compatible module, at the stage of editing a flow.

To create an SMOP, follow the steps below:

1. Click on "**Edit"** for the desired and compatible module. Then click on the plus sign "**+**" located in the parameter settings block:
2. The SMOP creation window will be displayed:

<figure><img src="/files/rypyyJqtZ5f7M0auJyPc" alt=""><figcaption></figcaption></figure>

* **param1** (optional): the original parameter that you want to manipulate must be dragged into this field, and it can be either a flow parameter or a parameter from the preceding flow components. You can also create SMOPs using JSONata operations that do not require parameters
* **value** (optional): if the **param** informed is a flow parameter, the value field will be automatically filled in, and you can also inform the value manually or even not inform it, as needed. The data type used must be compatible with the **param** informed;
* **add parameter**: add more parameters
* **expression** (required): here you must enter the **desired operation**. All JSONata expressions are valid. In addition to using a parameter, as in the [examples](https://skyone.atlassian.net/wiki/spaces/IPD/pages/2885649035/SMOP+%28Small+Operations%29+v1#Example-Operations) above, you can use functions like **$now()**, which require no parameters
* **result** (read-only): here you will see the result of the created **Expression**
* **type** (read-only): here you will see the data type of the displayed Result (string, number, Boolean, array or object). Note that the type you enter must match the type expected by the module/flow parameter

3. To add a parameter to the SMOP, select it from the available parameters. To do this, drag and drop it into the SMOP **param1** field. Click "**Add parameter"** if you want to add another parameter.

You can use up to 3 original parameters within a SMOP.

<figure><img src="/files/0Ph7qkobnIpYwEDCa2Ut" alt=""><figcaption><p>Example with 2 parameters</p></figcaption></figure>

4. Create a JSONata **expression** to perform the desired operation, using our template table. For example: `param1 + param2`.
5. The **Result** and **Type** fields will display the corresponding information.
6. Click "**Save"** to finish. The operation field will now display the expression "SMOP", denoting that a SMOP operation has been set up:

### **Editing an SMOP** <a href="#editing-an-smop" id="editing-an-smop"></a>

To edit a SMOP:

1. Click on the down arrow sign next to the field with the SMOP you want to edit:
2. Make the necessary changes and click "**Save"**.

### **Deleting an SMOP** <a href="#deleting-an-smop" id="deleting-an-smop"></a>

There are two ways to delete a SMOP:

1. Click on the sign on the right-hand side of the SMOP.
2. Open the editing modal and click on "**Delete".**

{% hint style="info" %}
It is not possible to reverse the deletion. If you need the same SMOP again, you will have to redo it
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.skyone.cloud/english/skyone-studio/integrations/flows/data-operations/smop-small-operations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
