Report Generator
The Report Generator module enables users to create, manage, and generate customized reports using SQL queries and report templates. Reports can be configured using system data sources or external database connections and exported in DOCX or HTML format.
Overview
The Report Generator provides the following capabilities:
- Create custom reports
- Configure report templates
- Define SQL queries
- Add report filters
- Generate reports in DOCX or HTML format
- Organize reports by project
- Edit or delete reports (based on permissions)
Report Generator List
The Report Generator home screen displays all available reports grouped by project.
Available Actions
| Action | Description |
|---|---|
| Add Report | Create a new report configuration |
| Refresh | Reload the report list |
| View Information | View query and filter configuration details |
| Edit | Modify report configuration (if editable) |
| Delete | Remove report configuration (if deletable) |
| Generate and download the report |
Conditions
- Edit button is enabled only when Is Editable = True
- Delete button is enabled only when Is Deletable = True
- Reports are grouped by Project
Creating a Report
Step 1: Select Report Format
When creating a new report, select one of the following formats:
| Format | Description |
|---|---|
| DOCX | Microsoft Word template |
| HTML | HTML-based report template |
Step 2: Configuration
Enter the following information:
| Field | Description |
|---|---|
| Report Name | Name of the report |
| Project | Project to which the report belongs |
Validation Rules
- Report Name is mandatory
- Project selection is mandatory
Step 3: Data Source Configuration
System Data Source
Enable System Data Source when report data should be retrieved from the MES application database.
No database configuration is required.
External Database
Disable System Data Source when data should be retrieved from an external database.
The following fields become mandatory:
| Field | Required |
|---|---|
| Host | Yes |
| Port | Yes |
| Database Name | Yes |
| User Name | Yes |
| Password | Yes |
| Schema | Yes |
Validation Rules
All database connection fields are required when System Data Source is disabled.
Step 4: SQL Query Configuration
Enter the SQL query used to retrieve report data.
Validation Rules
- SQL Query is mandatory
- Query must contain at least 15 characters
Example
SELECT *
FROM device_master
WHERE status = true;
Test Query
The Test Query option can be used to validate query execution before saving the report.
Step 5: Upload Template
Upload the report template based on the selected report format.
DOCX Format
Allowed file type:
.docx
HTML Format
Allowed file type:
.html
Validation Rules
- Template upload is mandatory
- Uploaded file type must match the selected report format
Step 6: Configure Filters
Filters allow users to provide input values during report generation.
Filter Fields
| Field | Description |
|---|---|
| Alias | Internal filter name |
| Field Name | Database field name |
| Label | Display label shown to users |
| Type | Filter input type |
Supported Filter Types
- Text
- Number
- Date
- Dropdown
Dropdown Filter
When Dropdown type is selected:
- Dropdown Query becomes mandatory
- Query should return dropdown values
Example:
SELECT division_name
FROM division_master
ORDER BY division_name;
Save Report
After completing all configurations:
- Verify report details.
- Validate SQL query.
- Upload the appropriate template.
- Configure required filters.
- Click Save Report.
The report will be available in the Report Generator list after successful creation.
Report Generation Flow
Notes
- Reports can be grouped by Project.
- Only editable reports can be modified.
- Only deletable reports can be removed.
- System reports may be protected from modification.
- Templates must match the selected report format.
- Filters are used during report execution to dynamically retrieve data.