لوگوی اسکیلیکس اسکیلیکس | Skilliks آکادمی و استودیوی ابزارهای AI تاریخ شمسی… --:--:--

Calculate totals with expressions and groups

آزاد تازه‌وارد تاییدشده امن

کارهای تکراری ترمینال، مدیریت شاخه‌ها، نوشتن پیام کامیت استاندارد و ساخت اسکریپت‌های کمکی را سریع و یکدست انجام می‌دهد. (شامل ۹ گام عملی · سازگار با Claude Code).

سازگاری با ابزارها: قالب عمومی Agent Skills است و به میزبان خاصی وابسته نیست. مشاهدهٔ جدول سازگاری

متن دستورالعمل (SKILL.md)

دسترسی کامل فعال است
---
name: expressions-groups
description: Design JasperReports typed calculation expressions, variables, groups, subtotals, running and report totals, and their calculation, reset, increment, and evaluation times. Use when totals are wrong, missing, repeated, shown too early, split across group breaks, or depend on sorting and null values; not for appearance-only changes or data-source connection problems.
---

# Calculate totals with expressions and groups

## Establish the calculation contract

Identify the exact engine/Java versions, the expression language, each field's Java type and nullability, the expected grouping keys and order, and the business rules for rounding, null amounts and empty input. Ask for missing rules instead of inventing rounding modes, tax rules or what a subtotal of no values should show.

## Workflow

1. Keep types exact. Use `java.math.BigDecimal` fields and variables for monetary values, make each expression's result match its declared class, and set scale or rounding only with an explicit `RoundingMode` from the specification. Avoid `Double` arithmetic for money and integer division for ratios.
2. Choose each variable's `calculation` (`Sum`, `Count`, `DistinctCount`, `Average`, `Lowest`, `Highest`, `First`, `Nothing` or `System`), `resetType` (`Report`, `Page`, `Column`, `Group` with `resetGroup`, or `None`) and, when needed, `incrementType`. `Sum` and `Count` skip null expression values, and a sum of no values is null, so guard printed results with an explicit fallback.
3. Set evaluation times deliberately. An element evaluated `Now` shows the value at the moment its band prints: a group header showing its group's total needs `evaluationTime="Group"` with `evaluationGroup`, a title or page header showing a report total needs `Report`, and page totals need `Page`. Use `Auto` only when one element mixes values with different reset times.
4. Groups break whenever the group expression changes between consecutive records; they do not collect matching records. Order the data by the full nested group key, preferably in the query (`ORDER BY`) so the database does the work. Use report `sortField` elements only when in-memory sorting of the whole dataset is acceptable, and check nested groups use the same key order.
5. Define empty-input behavior. With `whenNoDataType="AllSectionsNoDetail"`, the tested 7.1.1 runtime still prints group headers and footers with null field and variable values. Prefer `whenNoDataType="NoDataSection"` with a `noData` band when a group-oriented report has no records, or design every group band to handle nulls. Do not hide group headers with a `$V{REPORT_COUNT} > 0` print-when guard: the count is still 0 when the first group header prints, so the tested runtime drops the first header for real data too.
6. Keep calculations in the report only when they belong to presentation. Leave business totals computed elsewhere to the application and display them as parameters rather than recomputing them differently.

## Validate and deliver

Fill with synthetic ordered input that includes null values, at least two groups, one unsorted case and empty input. Assert exact subtotal and report-total values with `BigDecimal.compareTo` or exact formatted text, and check that group headers show delayed values while footers reset per group. State commands and results, and label any calculation you could not execute as unverified.

## Sources

- [Sample reference](https://jasperreports.sourceforge.net/sample.reference/README.html)
- [Schema reference](https://jasperreports.sourceforge.net/schema.reference.html)
- [API](https://jasperreports.sourceforge.net/api/index.html)


— ‹guest · 2026-11-29› —

این نسخه با نشانه‌گذاری اختصاصی حساب شما نمایش داده می‌شود. برای نصب سریع، به تب نصب و راه‌اندازی بروید.

مهارت‌های مشابه و پیشنهادی

مشاهدهٔ همه ←
توسعه وب
✦ Pro

Web Application Testing

«Web Application Testing» همان چیزی است که وقتی سر توسعه وب کار می‌کنید کم است: دستیار شما با این مهارت «مدیریت هوشمند …

⚡ /webapp-testing SKILL.md
Claude / Claude Code
۹۶/۱۰۰ ★ ۱۹۸,۷۹۴
توسعه وب
✦ Pro

Web Artifacts Builder

این مهارت با نام «Web Artifacts Builder» تجربهٔ یک کاربلد در توسعه وب را کنار دستیار شما می‌گذارد؛ کافی است درخواست بده…

⚡ /web-artifacts-builder SKILL.md
Claude / Claude Code
۹۶/۱۰۰ ★ ۱۹۸,۷۹۴
توسعه وب
✦ Pro

Docs Page Skill

برای کدها، APIها و تغییرات پروژه مستندات تمیز، README کاربردی و گزارش تغییرات (Changelog) قابل فهم می‌نویسد. (شامل ۱۹ گ…

⚡ /docs-page SKILL.md
Claude / Claude CodeOpenAI Codex +۱
۹۶/۱۰۰ ★ ۱۰۹,۵۹۶
توسعه وب
✦ Pro

Canopy Part Title

قواعد و مراحل استاندارد توسعه وب را به دستیار هوش مصنوعی اضافه می‌کند تا خروجی یکدست بگیرید. (شامل ۱۱ گام عملی · سازگار…

⚡ /canopy-part-title SKILL.md
Claude / Claude CodeOpenAI Codex +۱
۹۶/۱۰۰ ★ ۹۰,۱۴۸
توسعه وب
✦ Pro

Vercel React Best Practices

در طراحی مسیرهای سرور، فرم‌ها، فرانت‌اند مدرن و ارتباط امن کلاینت و سرور طبق استانداردهای روز کمک می‌کند. (شامل ۷۱ گام …

⚡ /vercel-react-best-practices SKILL.md
MCP
۹۶/۱۰۰ ★ ۵۳,۹۱۶
توسعه وب
✦ Pro

Find Skills

این مهارت با نام «Find Skills» تجربهٔ یک کاربلد در توسعه وب را کنار دستیار شما می‌گذارد؛ کافی است درخواست بدهید تا «توس…

⚡ /find-skills SKILL.md
Claude / Claude Code
۹۶/۱۰۰ ★ ۴۰,۵۰۹