My Dynamic Reporting Dashboard

My Dynamic Reporting Dashboard

Here is my attempt at a dynamic dashboard (IT WORKS!). It's designed to track and update the count of events for each month, all of which is stored in a Data Blaze database.

Essentially, it's my solution for a live reporting tool with interactive buttons.

Here is the breakdown of how it functions:

1. Initialization and Data Setup

The snippet starts by setting up its environment:

Loading State: It uses {isloading} and {loading} to manage the display while data is being fetched.

Categories: It defines a list of 11 specific status types (e.g., BANNED, CRASH, FI) to iterate through.

Variables: It sets {x=1}, which acts as the increment value for the update buttons later on.

2. Database Integration ({dbselect})

Inside a loop ({repeat}), the snippet queries a Data Blaze table:

It looks for a row where the Name column matches the current category in the loop.

It retrieves the current Count and the unique rowid() for that specific entry.

3. Conditional Logic and User Interface

For each category in your list, the snippet performs a check:

If the record is found: It displays the category name and its current count.

Interactive Button: It generates a button labeled "Add 1 to [Category]". When clicked, it triggers a {dbupdate} command that adds 1 to the count in the database instantly.

If the record is missing: It bolds the category name and displays a warning: Not found in Data Blaze.

(NOTE - This is by-far my most complicated snippet attempt to date!! It took forever to finally work thru the logic and actually get it to work as intended. Anyways, hopefully it will be useful to someone else or inspire someone else to improve it. <--- if so let me know!! :wink:

{isloading=loading}{loading=yes}
{categories=["BANNED", "CLEARED", "CRASH", "FI", "FOLLOW-UP", "IBR", "LAP", "SUMMONS", "TOWED", "WARRANT_ATTEMPT", "WARRANT_SERVED"]} {x=1}
CATEGORY - COUNT
{if: loading}{repeat: for cat in categories} {note: preview=no}{dbselect: SELECT Count, rowid() AS id, Name AS cat FROM FEB2026 WHERE contains(Name, `@cat`); name=record; space=5yyYk62ooIYAqWF6tK9YwQ}{endnote} {if: len(record) > 0}
{currentCount=record.count}
{currentId=record.id} {=cat}: {=record.count} {button: {dbupdate: UPDATE 
FEB2026 SET Count = ({=currentCount} + @x) WHERE rowid() = {=currentId}; space=5yyYk62ooIYAqWF6tK9YwQ; instant=yes}; label="Add 1 to " + {=cat}}{else} **{=cat}**: *Not found in Data Blaze* {endif} {endrepeat}{endif}


3 Likes