> For the complete documentation index, see [llms.txt](https://help.impact.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participants/custom-and-calculated-fields/edit-a-calculated-field.md).

# 编辑计算字段

计算字段值可用于设置程序规则，从而实现各种高级程序逻辑。用户创建的 [计算字段](https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participants/custom-and-calculated-fields/calculated-fields-explained.md) 可以随时编辑。

#### 编辑计算字段

1. 在左侧导航菜单中，选择 ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2Fgit-blob-230534471fef5f40808e921e41ee44e4a06ded03%2Fe6cb9548999afdc1ed3ce4942e4cb5b45b5cecbd323267aac2a7cd1915fccc09.svg?alt=media) **\[Engage] → Data Sources → Fields**.
2. 将光标悬停在要编辑的字段上，然后选择 **编辑**.
   * 必须选择用户创建的计算字段。默认计算字段无法编辑。
3. 根据需要编辑字段。
   * 您可以更改用于计算字段的事件，以及任何筛选条件或跟踪窗口。
   * 计算字段键和计算类型无法更改。
4. 您也可以在 *审核* 部分中选择 ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2Fgit-blob-b5e1740618ed6571d97b8fed7c25a7678f85d375%2F299632fb6f4f91fbf9847471754cc6180e4284a65b4960af4c4ea472a159f552.svg?alt=media) **\[Unchecked box] 保存时重新计算值**.
   * 如果字段使用 `sum` 或 `count` 计算，我们建议您请求 [重新计算](https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participants/custom-and-calculated-fields.md)。其他计算类型无法重新计算；进行更改前，请参阅 [重新计算注意事项](#edit-a-calculated-field) 。
5. 选择 **保存**.

#### 重新计算注意事项

| 如果                          | 那么                                                                                               | 示例                                                                                                                                                    |
| --------------------------- | ------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| 该字段没有跟踪窗口，或者跟踪窗口已被 **移除**.  | <p>• 将保留字段的先前值，并将其作为新计算的起始值。</p><p>• 后续将使用新的计算方式。</p>                                            | 该字段当前会对 `userPurchase` 事件的收入求和。将其更新为对 `purchase` 事件的收入求和后，参与者个人资料中的现有值不会改变。下次我们收到该参与者的购买事件时，收入金额会加到现有值上。                                              |
| 该字段已有跟踪窗口，且窗口 **未更改**.      |                                                                                                  |                                                                                                                                                       |
| 正在向 **现有计算字段** 添加跟踪窗口       | <p>• 仅在新事件到来之前保留字段的先前值。下一个匹配的事件到来时，该值将被清除。</p><p>• 后续将使用新的配置。</p><p>• 如果要将历史数据纳入新配置，请请求重新计算。</p> | <p>该字段会统计参与者的购买次数。如果添加一个月的跟踪窗口，参与者个人资料中的现有值将在下一个购买事件到来时被清除。</p><p>一位购买过 5 次的参与者在您编辑之前，其值为 <code>5</code> 。该参与者下次购买时，旧值将被清除，字段值将设为 <code>1</code>.</p> |
| 该字段已有跟踪窗口，且该窗口正在被 **编辑**.   | <p>• 编辑计算字段上的现有窗口时，请务必重新计算。</p><p>• 未重新计算就进行编辑，可能会对参与者的字段值产生不利影响。</p>                            | 您将跟踪窗口从固定窗口更改为滑动窗口。                                                                                                                                   |
| 该字段已有一个滑动窗口，且 **最大计算值已更改**. | <p>• 下一次收到匹配事件时，新配置将应用于参与者的历史数据。</p><p>• 请求重新计算，即可更新字段值，无需等待新事件。</p>                             | 此窗口字段当前统计参与者进行的购买次数，最多计为 10 次。将最大值改为 5 后，如果该参与者收到新的购买事件，窗口内的数据将追溯应用最大值 5。                                                                             |

{% hint style="warning" %}
**警告：** 无法通过 API 手动覆盖窗口计算字段的值。如果您发送的数据会覆盖现有值，将收到一条错误消息。
{% endhint %}


---

# 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://help.impact.com/brand/zh/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participants/custom-and-calculated-fields/edit-a-calculated-field.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.
