> For the complete documentation index, see [llms.txt](https://docs.gpmautomate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gpmautomate.com/huong-dan-cac-action/text-and-number/math-execute.md).

# Math execute

Math execute là hành động dùng để thực hiện các phép tính toán học cơ bản (như cộng `+`, trừ `-`, nhân `*`, chia `/`) hoặc các biểu thức số học phức tạp từ các biến số có sẵn, sau đó lưu kết quả vào một biến đầu ra.

🎥 Xem thêm video hướng dẫn: [Tại đây](https://youtu.be/nlEQsaxawt4).

#### Tham số cấu hình:

* Expression (Biểu thức): Nội dung phép tính toán học cần thực hiện. Bạn có thể kết hợp giữa các con số cụ thể và các biến số có sẵn (Ví dụ: `(5 + 3) * 2` hoặc `$price * $quantity`).
* Output variable: Tên biến để lưu lại kết quả sau khi tính toán xong.

#### Ví dụ thực tế 1: Tính tổng số tiền đơn hàng (Nhân và Cộng)

Giả sử bạn đang làm kịch bản tự động mua hàng hoặc cào dữ liệu đơn hàng. Bạn có biến số lượng sản phẩm là `$quantity = 3`, biến đơn giá là `$price = 150000`, và phí vận chuyển cố định là `30000`.

* Cách cấu hình:
  * Expression: Điền biểu thức `($price * $quantity) + 30000`
  * Output variable: Điền tên biến lưu kết quả là `$totalAmount`.
* Kết quả: Hệ thống sẽ tính ra giá trị là `480000` và gán vào biến `$totalAmount`.

<figure><img src="/files/r7aruMkOA69DdM2uuSyC" alt=""><figcaption></figcaption></figure>


---

# 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.gpmautomate.com/huong-dan-cac-action/text-and-number/math-execute.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.
