> ## Content Index
> Fetch the complete content index at: https://blog.jestor.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Como somar valores de uma tabela em um campo de outra tabela no Jestor
- URL: https://blog.jestor.com/como-somar-valores-de-uma-tabela-em-um-campo-de-outra-tabela-no-jestor-2/
- Published: 2021-06-28T19:05:27.000Z
- Updated: 2021-06-28T19:05:27.000Z
- Author: Fernando Nakandakari
- Tags: Como usar Tricks, #Migrated-1742495932782, #wp, #wp-post, #Import 2025-03-20 11:39

Gerenciar vendas é uma parte importante da operação de uma empresa. Ter processos simples e escaláveis é extremamente importante. Aumente a eficiência do seu time de vendas economizando tempo ao ter o valor total da venda automatizado ao registrar itens da venda.

**Configurando o Trick :)**

1. **Vá para a tabela em que deseja automatizar e abra o painel de Criar Tricks:** você pode abrir o painel clicando no ícone da cartola e clicando em “+ Add Trick” ou pressionando (T).

![](https://lh6.googleusercontent.com/V5WL79Hr-N-dbER63QLINfQVyR9K5g-fvEqlqy9_g3ogKFmo2_xUZK9gjQGEg-6-G-_GbFaMlI_oSo72x7DNXnL3IQvatjV84JehR5uUeLfkiTHlgskxHJrriz0BUAR4SpKxuPzx)

1. **Dê um nome a sua trick, escreva uma descrição e escolha uma trigger :** a trigger é o que define quando a automação irá acontecer. Neste exemplo, utilizaremos a trigger “When a new record is created in Jestor”.

![](https://lh4.googleusercontent.com/E9LMJUSdSQEhGYwTKUVsEZ-VF__voQ9pGyd5G1vBd5Oo4HPb1tDBOuyUDF3_x_eCvhj1jXZllIHYSLbvCMfTXJcWFHE6qzlKq95YdhN0m_hCTW9CQ9fG4dodvlIIPSpQoVhyi3DC)

1. **Clique em “+ Add action” e escolha “Update Quantities” com o símbolo do “Jestor”:**

A ação é o comando que será executado quando a trigger for ativada.

![](https://lh3.googleusercontent.com/PpdU1k8cV8S8PZbrJiIXXtCf1xzA7pXoXXMkA8-TjFzzSDp3NHeUTc-JoZDRpBwmTGP2tyXz58uNbEEZMceP4nStmvyPcFmSt8rVGrbDRM3JA7I4wm7mAgLD4zLiXJmRDjOsss1u)

1. **Configurando a ação quando a trigger é disparada:** Após conectar a conta, você precisará informar alguns campos para que sua automação funcione corretamente.
- **“Choose the Main tab”:** aqui você irá informar a tabela principal.
- **“Set the quantity field to update”:** aqui você escolherá qual campo numérico da tabela principal será atualizado.
- **“Choose the secondary tab where the quantities to be added/subtracted are found”:** aqui você irá informar a tabela secundária.
- **“Choose the field that links the secondary tab to the record being created/updated”:** aqui você irá informar qual campo de relacionados está ligando a tabela secundária à principal.
- **“Choose the field that links the secondary tab to the main tab”:** aqui você irá informar qual campo de relacionados está ligando a tabela secundária à principal.
- **“Choose the field on the secondary tab that has the quantities to add or subtract”:** aqui você escolherá qual campo numérico da tabela secundária será somado ou subtraído.
- **“Set the id of the record being created/updated”:** aqui você informará o id dos itens que serão atualizados.
- **“Choose whether to add or subtract quantity”:** escolha entre somar ou subtrair.

5\. **Clique em “Save” e depois em “Create”.**

Está feito! Toda vez que um novo registro for criado na aba escolhida durante a configuração da trigger, o valor de uma venda será somado com os valores dos itens da venda..