Report Designer
Report Designer is used to create and maintain report files: SQL queries, filters shown to users, HTML/EJS templates, print/export permissions, export file names, page setup, and preview.
Menu Route
General Designer
/reportdesigner
When to Use
- When a new report needs to be built from application data.
- When report filters need to be added, made required, locked by role, or changed to another input type.
- When report results are wrong because SQL, filter placeholders, or child queries need correction.
- When report layout needs updates such as title, table, subtotal, grand total, chart, text, or print layout.
Basic Concepts
- Report File is the report definition selected from the server.
- Report Path is the code used by menus, preview, and route opening. Do not change it without checking related menus.
- SQL Code is JSON containing
mainsqland optionalchildrensql. Query results becomedatain the template. - Filter Definition controls the input shown before running the report.
- HTML/EJS controls report output. HTML defines layout; EJS reads data, loops rows, calculates totals, and shows conditional content.
- Preview runs the report being edited so the implementor can inspect filters, output, and sample data.
Workflow
- Open General / Report Designer.
- Select the report file to edit.
- Before changing an important report, use Duplicate or Export JSON.
- Review Name, Description, Report Path, Report Type, SQL Code, Filter Definition, HTML/EJS, and Default Page Setup.
- Make sure each filter Field Name matches placeholders used in SQL Code.
- Run Preview, fill filters, and compare rendered output with sample data.
- Click Save only after the query, filters, and template are correct.
Filter Definition
| Setting | Explanation |
|---|---|
| Field Name | Technical filter name used in SQL placeholders such as <--salesdate-->. |
| Label | Text shown to users. It can use language keys such as customer or division. |
| Filter Type | Input type: text, select, autocomplete, toggle, date, time, datetime, decimal, or integer. |
| Default Value | Initial value shown to users. |
| Operands | Operators such as =, like, or between. |
| Required | Makes the filter mandatory before the report runs. |
| Lock Filter | Makes the filter readonly based on a condition, often user role. |
| Filter Having | Places the filter in HAVING instead of WHERE for aggregate results. |
SQL Code
- SQL Code is JSON, not just plain SQL text.
mainsqlis the main query.childrensqlis used for nested report details.<-customfilter->is replaced by WHERE filters generated from user input.<--filtername-->is replaced by SQL condition for that filter.<--filtername.value-->reads the selected filter value directly.<---fieldname--->reads the parent row value for child queries.<-customhaving->and HAVING placeholders are used for aggregate filters.
HTML/EJS and Preview
- Common variables include
data,form,company,users,filter,filterdata,langs,functions,langId,server, anduserroles. datais the SQL result. If SQL has child queries, the data structure is nested.filtercontains filter definitions.filterdatacontains selected values.- Use Code mode for reports with many loops, subtotals, or conditions.
- Preview runs the current report file and shows rendered output plus sample data for field matching.
Import, Export, Duplicate, and Delete
- Duplicate is the safest first step before editing an active report.
- Export JSON creates a backup that can be restored or moved to another server.
- Import loads a report JSON file into the designer; review Report Path before saving.
- Delete only reports that are no longer connected to menus or active users.
Print and Export Setup
- Allow Print controls whether users can print the report.
- Allow Export controls whether users can export data.
- Report Type controls whether output is HTML or text.
- Default Page Setup controls paper size, orientation, and margins.
- Export Filename can use placeholders to produce meaningful downloaded file names.
Things to Check
- Incorrect SQL can produce empty, slow, or wrong reports.
- If Preview is empty, check required filters, placeholders, field names, child queries, and HTML/EJS.
- If filters do not work, compare Filter Definition Field Name with SQL placeholders.
- If print/export differs from Preview, check Allow Print, Allow Export, Report Type, Export Filename, and Default Page Setup.
- Export Filename can use placeholders such as
{{datetime}},{{report.xxx}},{{company.xxx}},{{username}},{{filter.xxx}}, and{{filterdata.xxx}}.