> For the complete documentation index, see [llms.txt](https://wedocs.gitbook.io/wedocs-5.2/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wedocs.gitbook.io/wedocs-5.2/wedocs-4.5/client-desktop/administracao/biblioteca-de-funcoes.md).

# Biblioteca de funções

Weknow Client Desktop – Configurações - Biblioteca de funções

Em *<mark style="color:blue;">Configurações</mark>* <mark style="color:blue;"></mark><mark style="color:blue;">>></mark> <mark style="color:blue;"></mark>*<mark style="color:blue;">Biblioteca de funções</mark>* temos uma área para o cadastrado/edição e exclusão das funções personalizadas:

<div align="left"><figure><img src="https://content.gitbook.com/content/N7r0bP9SU8lOOYpUAhaP/blobs/8OeFAG7h5UySgm0EuiGG/image.png" alt=""><figcaption></figcaption></figure></div>

Ao clicar em biblioteca das funções irá abrir a janela para o cadastrado de novas funções pesquisa das funções cadastradas:

<div align="left"><figure><img src="https://content.gitbook.com/content/N7r0bP9SU8lOOYpUAhaP/blobs/dEpZFpLoYxZJKTsFbcpy/image.png" alt=""><figcaption></figcaption></figure></div>

* Para criar uma nova função, clique em nova;

<figure><img src="https://content.gitbook.com/content/N7r0bP9SU8lOOYpUAhaP/blobs/Zp8YTw3Sb76o6DkyPmXX/image.png" alt=""><figcaption></figcaption></figure>

Após personalizar sua função, basta clicar em salvar que ela estará disponivel para o uso.

<div align="left"><figure><img src="https://content.gitbook.com/content/N7r0bP9SU8lOOYpUAhaP/blobs/XrOs7Id8zY6IjKul9Lot/image.png" alt=""><figcaption></figcaption></figure></div>

Um exemplo poderia criar uma função chamada, por exemplo, Plural que aceitaria 4 parâmetros `(valor, singular, plural, zero)` e teria a fórmula:

`if(`&#x20;

&#x20;  `:valor > 1,`&#x20;

&#x20;  `:valor _ ' ' _ :plural,`&#x20;

`if(`&#x20;

&#x20;  `:valor > 0,`&#x20;

&#x20;  `:valor _ ' ' _ :singular,`&#x20;

&#x20;  `:zero`

&#x20;`)`&#x20;

`)`

E com a nova função usaria ela da seguinte forma:

`Plural(getVar('qt_atendimento'), 'atendimento', 'atendimentos', 'Nenhum atendimento')`

Caso precise criar um novo campo desse estilo, basta chamar a função que criou. Se, eventualmente, notar que há um erro nessa fórmula, basta alterar dentro da função e isso se refletirá em todos os campos que a usam.
