apex_add_metric_cards
Add KPI metric cards to Oracle APEX pages. Each card displays a value from a SQL query with customizable label, icon, color, and style options like gradient, flat, or outline.
Instructions
Add styled KPI metric cards (gradient/flat/outline). Each metric: label + sql + icon + color.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| style | No | Visual style: - "gradient": Colored gradient background with white text (default) - "white": White card with colored accent border - "dark": Dark card with neon accent | gradient |
| columns | No | Number of columns in the card grid (2, 3, 4, or 6). | |
| metrics | Yes | List of metric definitions. Each dict supports: - "label": Display label (required, e.g., "Pacientes Ativos") - "sql": SQL query returning a single value (required, e.g., "SELECT COUNT(*) FROM TEA_BENEFICIARIOS WHERE FL_ATIVO='S'") - "icon": Font Awesome icon class (e.g., "fa-users", "fa-chart-bar") - "color": Color theme: "blue" | "green" | "orange" | "red" | "purple" | "teal" | "indigo" | "amber" (auto-assigned if omitted) - "prefix": Text before value (e.g., "R$", "$") - "suffix": Text after value (e.g., "%", "pts") - "subtitle": Optional secondary text under the value - "link_page": Page number to link to on click (optional) Example: [ {"label": "Pacientes Ativos", "sql": "SELECT COUNT(*) FROM TEA_BENEFICIARIOS", "icon": "fa-users", "color": "blue"}, {"label": "Taxa de Conclusão", "sql": "SELECT ROUND(AVG(NR_PCT_TOTAL)) FROM TEA_AVALIACOES", "icon": "fa-check-circle", "color": "green", "suffix": "%"}, ] | |
| page_id | Yes | Target page ID. | |
| sequence | No | Region display order on the page. | |
| region_name | Yes | Region title (hidden by default). | |
| color_palette | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |