Report Template
Menu path: Model Management → Report Template. Report templates define the generation logic and configuration for PDF or Excel files and can be reused by RPCs that output reports. View generated records under Log Management → Report Records.
Create and Configure
| Field | Requirement and purpose |
|---|---|
| Code | Required. Identifies the template and is entered separately from its display name. |
| Name | Required. Displayed in the template list. |
| Template Type | Required. Supports PDF and Excel; initially set to PDF for a new template. |
| Remarks | Optional. Describes the purpose of the report. |
| Change Description | Optional. Records what changed and why. |
Configuration Parameters (config) | The template's JSON configuration, such as titles, chart titles, or worksheet names. |
Example Input (input) | JSON sample data for the editor preview, such as a device name and data rows. |
The editor provides Configuration, JSON Configuration, and Preview tabs. The list supports filtering by code, name, and template type, and provides import and export actions. The system platform also provides report template management, with an additional Organization field. Check whether you are configuring a tenant-level or system-level template.
Preview Data and Actual Calls
Reports run on the server. Expand the available-parameter reference in the editor to inspect inputs, tools, and execution limits.
| Variable | Actual report generation | Editor preview |
|---|---|---|
config | Template configuration; an RPC can override individual keys through dnMsg.data.config. | Uses the configuration parameter editor contents. |
input | Data for this call, passed by the RPC through dnMsg.data.input. | Uses the example input editor contents. |
device | Context of the device that triggered the report. | Empty object {}. |
params | Input parameters for this RPC call. | Empty object {}. |
org_params | Current organization parameters. | Uses the same organization parameter source as actual calls. |
meta | Information about the template, generation time, device, RPC, trigger source, and operator. | meta.preview is true; device and RPC fields are empty. |
Actual calls do not fall back to the example input. If the RPC does not pass input, the template receives an empty object. Data in the preview does not prove that an actual call supplies data. Templates that depend on device or params must also handle empty preview context.
meta includes preview, generate_time, tenant_code, template_id, template_code, template_name, template_type, eui, rpc_id, rpc_method, source_type, operator_id, and operator_name. generate_time is an ISO 8601 timestamp string.
Tools and Execution Limits
| Tool or limit | Description |
|---|---|
ctx | Provides report utilities including chart(option), formatDate, formatNumber, and escape. Escape external text before including it in HTML. |
axios, fetch | Retrieve data from external systems. Each HTTP request is limited to 15 seconds. For HTTP 404/500 responses, check resp.ok when using fetch; do not rely only on exceptions. |
dayjs, Buffer, console | Date handling, restricted binary processing, and server-side logging. |
setTimeout / clearTimeout | Available; setInterval is unavailable. |
AbortController / AbortSignal | Can cancel HTTP requests or shorten the wait. |
| Promise wait | The page documents a 25-second limit for new Promise / Promise.all. |
| Overall execution | The entire template is limited to 30 seconds. Multiple slow sequential requests may reach the overall timeout first. |
| Unavailable environment | No window, document, require, or setInterval. |
Preview uses the server-side report runtime, including real organization parameters and HTTP tools. Check whether the template accesses external services before previewing it. Opening the page or saving configuration does not verify data retrieval or report generation.
Troubleshooting Order
- Check the template type, code, and template selected by the actual call.
- Check the actual
inputandconfig, rather than only the preview sample. - Check the required device context, organization parameters, and external data retrieval results.
- Check for timeouts and APIs unsupported by the runtime.
- In Report Records, confirm the generated record, file type, storage method, and time.