> For the complete documentation index, see [llms.txt](https://docs-kpi-software.gitbook.io/doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-kpi-software.gitbook.io/doc/parametros-especiais/co.md).

# CO;

Este parâmetro é essencial para garantir uma boa performance da ferramenta

{% hint style="danger" %}
**Dica importante:**

Utilize o parâmetro **CO;** sempre que:

1. O indicador atualizar de forma dependente;
2. Utilizar a mesma regra dentro da mesma fórmula;
3. Em Detalhes do indicador;
   {% endhint %}

Este parâmetro deve ser utilizando dentro de cada função, quando permitir.

<mark style="background-color:green;">Sua finalidade é a de consultar a regra em memória.</mark>&#x20;

Analise a função abaixo:

> #### COUNT(#10)

Esta função irá executar a regra 10 e registrar o resultado desta regra em uma memória. Isto se faz necessário para possibilitar um uso melhor da necessidade de se ir à fonte de dados a todo momento. Agora, analise a função abaixo utilizando o parâmetro especial CO;.

> #### COUNT(CO;#10)

Isto permite consultar a regra 10 na memória sem o acesso à fonte de dados que a gerou. Permitindo assim, um ganho impressionante de recursos.

Agora, para ficar mais interessante, vou apresentar um problema de performance de uma fórmula:

{% hint style="danger" %}
**Não utilizar**

#### COUNT(<mark style="background-color:red;">#10</mark>\[ SITPED = 5 ]) + COUNT(<mark style="background-color:red;">#10</mark>\[ SITPED = 3 ])

{% endhint %}

Esta sequencia de funções em uma fórmula faz com que o server do KPI execute duas vezes a regra 10 de forma desnecessária.

Caso o desenvolvedor necessitar utilizar desta forma, o uso correto seria assim:

{% hint style="success" %}
**Utilizar**

#### COUNT(<mark style="background-color:green;">#10</mark>\[ SITPED = 5 ]) + COUNT(<mark style="background-color:green;">CO;#10</mark>\[ SITPED = 3 ])

{% endhint %}

Isto faria o server do KPI executar a regra 10 apenas uma vez e filtre os SITPED = 5. Posteriormente, consulta a regra 10 e aplica o filtro SITPED = 3

Pronto!


---

# 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, and the optional `goal` query parameter:

```
GET https://docs-kpi-software.gitbook.io/doc/parametros-especiais/co.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
