# Análises Online

De modo a criar/configurar uma análise online terá de selecionar "Novo".&#x20;

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

Ao criar uma nova análise online, terá de preencher a *descrição*, o *tipo de análise*, o *tipo de conexão* onde a query vai ser executada, ou middleware ou ERP, e a *expressão SQL* desejada. Tem ainda a possibilidade de definir se a análise é **geral** ou se é destinada a **clientes&#x20;**<mark style="color:red;">**(1)**</mark>.

<figure><img src="/files/XKELMjkihv6mzq532vSG" alt=""><figcaption><p>Detalhes</p></figcaption></figure>

Após preencher os **detalhes**, necessita de adicionar a **estrutura** do resultado da query.

<figure><img src="/files/i2pqpMOOchxSTRYgrydx" alt=""><figcaption><p>Estrutura</p></figcaption></figure>

Na estrutura, o campo é referente ao nome dado a cada coluna da query, a Descriçao serà o nome a aparecer na tabela no resultado presente no dispositivo, assim como a largura dessa coluna. A ordenação indica a ordem das colunas da esquerda para a direita.&#x20;

<figure><img src="/files/bqFJ2hJQojMi0pR87ltK" alt=""><figcaption><p>Adicionar Estrutura</p></figcaption></figure>

O passo seguinte será adicionar as variáveis a preencher no dispositivo de forma a garantir o resultado da análise.

<figure><img src="/files/KXZcBIRSx7dtbRO0oEU7" alt=""><figcaption><p>Variáveis </p></figcaption></figure>

Ao adicionar uma nova variável necessita de preencher o campo **Variável** com o que foi preenchido na query, como podemos ver no print do exemplo acima. A descrição será o nome a aparecer  no dispositivo aquando o preenchimento da variável e o tipo de dados vai definir o tipo de input no dispositivo.

<figure><img src="/files/j8uhj2a0a6mSAMS9x01c" alt=""><figcaption><p>Adicionar variável</p></figcaption></figure>

{% hint style="info" %}
Existem variáveis reservadas que tem que estar presentes na query mas não necessitam de ser adicionadas nas Variáveis. São elas:

* <mark style="color:blue;">**@SellerNumber**</mark> - número de vendedor
* <mark style="color:blue;">**@TerminalId**</mark> - número do terminal
* <mark style="color:blue;">**@CuNumber**</mark> - número do cliente
* <mark style="color:blue;">**@Estab**</mark> - estabelecimento do cliente
  {% endhint %}

O último passo é atribuir os terminais em que deseja que a análise online esteja disponível.

<figure><img src="/files/PaUoNahPf8jUHKNZWCZW" alt=""><figcaption><p>Terminais</p></figcaption></figure>


---

# Agent Instructions: 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.wave.pt/wave-trade-x/back-office-implementacao/analises-online.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.
