> For the complete documentation index, see [llms.txt](https://helpcenter.channable.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://helpcenter.channable.com/manage-improve-product-data/manage-product-and-improve-data-fr/regles-modifier-et-enrichir-en-masse/how-to-use-actions-then-in-rules/actions-mathematiques/rule-action-calculate-sum.md).

# calculer la somme des valeurs

Calculer le total des valeurs numériques stockées dans un champ de liste.

Utiliser **`Calculer la somme`** pour additionner toutes les valeurs numériques d’un champ de liste.

Cette action est utile notamment pour :

* Calculer le stock total pour différentes tailles de produits.
* Calculer un total à partir de plusieurs valeurs numériques.

***

## Exemple `Calculer la somme` cas d’utilisation

### Calculer le stock total pour différentes tailles

Utilisez cette règle lorsque chaque produit a une valeur dans le `stock` champ. premier, utiliser [Créer des groupes de produits](https://helpcenter.channable.com/manage-improve-product-data/manage-product-and-improve-data-fr/regles-modifier-et-enrichir-en-masse/how-to-use-actions-then-in-rules/actions-sur-les-produits/rule-action-build-item-group.md) pour collecter les `stock` valeurs des Produits ayant le même `item_group_ID` dans un nouveau `stock_list` champ. Alors, utilisez **`calculer la somme`** pour additionner les valeurs dans `stock_list` et enregistrez le total dans `total_stock`.

#### Comment créer une Règle

* Condition : **`Pour Tous les Produits`**
* Action : ALORS **`Construire un groupe de produits`** en fonction de `item_group_ID` du champ `stock` et stocker dans `stock_list`
* Action : ALORS **`Calculer la somme`** de `stock_list` et stocker dans `total_stock`

{% hint style="info" icon="lightbulb" %}

#### Conseil

Ajouter **`construire un groupe de produits`** avant **`calculer la somme`**. Le `stock_list` Le champ doit exister avant que vous puissiez calculer son total.
{% endhint %}

### Ajouter les quantités en stock de l’entrepôt

Utilisez cette règle lorsqu’un champ de liste contient les quantités en stock de plusieurs entrepôts.

#### Comment créer une Règle

* Condition : **`Pour Tous les Produits`**
* Action : ALORS **`calculer la somme`** de `warehouse_stock_list` et stocker le résultat dans `available_stock`


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://helpcenter.channable.com/manage-improve-product-data/manage-product-and-improve-data-fr/regles-modifier-et-enrichir-en-masse/how-to-use-actions-then-in-rules/actions-mathematiques/rule-action-calculate-sum.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
