Skip to Content
ComponentsReport Builder

Report Builder

The Report Builder is a comprehensive tool for generating, customizing, and sharing data reports. It supports dynamic field selection, filtering, grouping, and drill-down capabilities.

Usage

import { ReportBuilder } from '@orbitusdev/components/report-builder'; import type { ReportDefinition } from '@orbitusdev/business/reporting/types'; const definitions: ReportDefinition[] = [ { key: 'sales-report', label: 'Sales Report', fields: [ { key: 'date', label: 'Date', type: 'date' }, { key: 'amount', label: 'Amount', type: 'currency' }, { key: 'status', label: 'Status', type: 'select', options: [...] } ] } ]; export default function ReportsPage() { return <ReportBuilder definitions={definitions} />; }

Features

Report Configuration

  • Field Selection: Users can choose which columns to display in the report.
  • Filtering: Advanced filtering capabilities based on field types (e.g., date ranges, numeric comparisons, text search).
  • Grouping: Group data by specific fields to see aggregated results.

Data Management

  • Run Report: Fetches data based on the current configuration.
  • Export: Exports the current report data to Excel.
  • Drill-Down: Click on grouped rows or specific cells to view detailed underlying data.

Savings & Sharing

  • Save Configuration: Save report configurations (columns, filters, grouping) for quick access later.
  • Save Filters: Save specific filter sets to be reused across different reports.
  • Sharing: Generate public links to share reports with external stakeholders (includes expiration and access control).
  • Scheduling: Schedule reports to be sent automatically via email at specified intervals.

Components

ReportBuilder

The main container component that orchestrates the reporting workflow. It manages the state for the report configuration and handles interactions with the backend API.

FilterBuilder

A dedicated component for constructing complex filter logic. It adapts the UI based on the field type (e.g., date pickers for dates, dropdowns for enums).

ReportResults

Displays the report data in a tabular format. It supports:

  • Pagination
  • Sorting
  • Grouping visualization
  • Drill-down interactions

API Integration

The Report Builder relies on several server actions/API endpoints:

  • fetchReportData: Retrieves the dataset based on the configuration.
  • exportReportToExcel: Generates an Excel file of the report.
  • saveReport/getSavedReports: Manages saved report configurations.
  • generateShareLink: Creates public access tokens for reports.
Last updated on