Run Report
Execute reports based on MReportMaster configuration and return report data. Supports existing reports by ID or ad-hoc reports with full configuration
Run Report
Execute reports based on MReportMaster configuration and return report data. The function supports executing existing saved reports by ID or creating ad-hoc reports with full configuration. It supports multiple input patterns for flexibility.
Technical Name: RunReportFunc
Properties
- Execution Mode: SYNC
- Type: NATIVE
- Category: System Functions
- Function ID:
a7c9f3b2-4e5d-4a1f-9b8c-2d3e4f5a6b7c
Input Schema
The function supports three input patterns:
Pattern 1: Nested with reportConfig (Ad-hoc Reports)
Use this pattern for ad-hoc reports with full configuration:
| Parameter | Type | Description |
|---|---|---|
reportConfig | object | Complete MReportMaster configuration object |
formatResponse | boolean | Whether to format the response (default: false) |
Pattern 2: Nested with reportMaster (Ad-hoc Reports)
Alternative nested pattern:
| Parameter | Type | Description |
|---|---|---|
reportMaster | object | Complete MReportMaster configuration object |
formatResponse | boolean | Whether to format the response (default: false) |
Pattern 3: Flat Structure (Existing Reports)
Use this pattern for existing reports by ID or flat configuration:
| Parameter | Type | Description |
|---|---|---|
reportId | string (UUID) | UUID of existing report to execute |
reportName | string | Name of the report |
flowId | string (UUID) | UUID of the flow to execute (optional) |
dashboardId | string (UUID) | UUID of the dashboard (optional) |
description | string | Report description |
reportConfig | object | Report configuration (QueryMaster, filters, etc.) |
additionalFilters | object | Additional filters to apply |
drilldownFilters | object | Drilldown filters to apply |
globalFilters | object | Global filters to apply |
drillDownConfig | object | Drill down configuration |
formatResponse | boolean | Whether to format the response (default: false) |
[Image placeholder: RunReport function configuration panel]
Input Examples
Execute Existing Report by ID
{
"reportId": "123e4567-e89b-12d3-a456-426614174000",
"formatResponse": false
}Ad-hoc Report with Nested Config
{
"reportConfig": {
"reportName": "Sales Report",
"reportConfig": {
"query": {
"selectFields": [
{
"fieldName": "amount",
"fieldAlias": "Total Sales"
},
{
"fieldName": "date",
"fieldAlias": "Date"
}
],
"fromClause": {
"mobjectId": "sales-mobject-uuid"
},
"criteriaTree": {
"lhs": {
"fieldName": "date"
},
"operator": "greaterThanOrEquals",
"rhs": {
"value": "2024-01-01"
}
}
}
},
"additionalFilters": {},
"globalFilters": {}
},
"formatResponse": true
}Flat Structure with Filters
{
"reportName": "Customer Analysis",
"reportConfig": {
"query": {
"selectFields": [
{
"fieldName": "customer_name",
"fieldAlias": "Customer"
},
{
"fieldName": "total_orders",
"fieldAlias": "Orders"
}
],
"fromClause": {
"mobjectId": "customer-mobject-uuid"
}
}
},
"additionalFilters": {
"status": "Active"
},
"formatResponse": false
}Output Schema
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates if the report execution was successful |
data | object | Report data result (structure depends on report type and formatResponse) |
error | string | Error message if execution fails |
Output Example
Success Response
{
"success": true,
"data": {
"columns": [
{
"fieldAlias": "Total Sales",
"fieldName": "amount"
},
{
"fieldAlias": "Date",
"fieldName": "date"
}
],
"data": [
{
"Total Sales": 5000,
"Date": "2024-01-15"
},
{
"Total Sales": 7500,
"Date": "2024-01-16"
}
],
"totalRecords": 2
}
}Error Response
{
"success": false,
"error": "Error executing report: Report configuration is required"
}[Image placeholder: RunReport output visualization]
How It Works
The function performs the following steps:
- Parse Input: Detects the input pattern (nested
reportConfig, nestedreportMaster, or flat structure) - Load Report Configuration:
- If
reportIdis provided, fetches the saved report configuration - Otherwise, uses the provided configuration
- If
- Apply Filters: Applies additional filters, drilldown filters, and global filters if provided
- Execute Report: Runs the report query using
MReportService.runReport() - Format Response: Optionally formats the response based on
formatResponseflag - Return Result: Returns report data with success status
Use Cases
Execute Saved Report
Run a pre-configured report by ID:
{
"reportId": "saved-report-uuid"
}Dynamic Report with Filters
Create a dynamic report with runtime filters:
{
"reportConfig": {
"reportName": "Dynamic Sales Report",
"reportConfig": {
"query": {
"selectFields": [
{"fieldName": "amount", "fieldAlias": "Sales"},
{"fieldName": "region", "fieldAlias": "Region"}
],
"fromClause": {
"mobjectId": "sales-mobject-uuid"
}
}
},
"additionalFilters": {
"region": "${workflow.region}",
"date_range": "${workflow.dateRange}"
}
}
}Workflow Report Execution
Execute reports within workflows:
Start → FetchMData → RunReport → ProcessResults → End[Image placeholder: Workflow example]
Formatted Report Output
Get formatted report data:
{
"reportId": "report-uuid",
"formatResponse": true
}Notes
- Report ID Priority: If
reportIdis provided, the function loads the saved report configuration and ignores other configuration fields - Ad-hoc Reports: For ad-hoc reports, provide complete
reportConfigwith query structure - Filter Application: Filters are applied in order: global filters → additional filters → drilldown filters
- Format Response: When
formatResponseistrue, the response includes formatted data suitable for display - Query Structure: The
reportConfig.queryfollows QueryMaster structure with selectFields, criteriaTree, joinInfos, etc. - Materialized Views: Reports may use materialized views for performance optimization
Related Functions
- Fetch MData - Retrieve MData records with filtering and pagination
- Export - Export query results to CSV format
- Pipeline Query - Execute queries with data transformation and materialized views