Parsware
همهٔ مقاله‌ها

Parsware Platform

A dashboard in an app

A dashboard in Parsware is a screen you draw. Counted tiles, charts, the table's own grid and its quick create form sit on one page, and the page goes into an app's navigation like any table.

این مقاله فقط به انگلیسی در دسترس است.

A Support overview screen in dark mode inside the Support desk app: four counted tiles, a bar chart of tickets by status, an urgent-or-not donut, a grid of tickets and a New ticket form, next to the title "A dashboard in an app"

A list of rows answers "which ones?". A dashboard answers "how many, and where are they piling up?". In Parsware a dashboard is a drawn screen: you lay out the page in the Application Studio, and the numbers, charts and grids on it are live. Then you put the screen into an app's navigation, next to its tables.

This article uses the studio-dashboard sample. Import it into an environment and open Support overview from the apps list. Every picture is the real product.

What's in the sample

Ticket is a small table: a Summary, a Status choice (New, Active, Resolved) and an Urgent yes/no. It comes with a quick create form, a main form and an All tickets view. The sample's app is one drawn screen, Overview.

The table starts empty, so press Add 24 tickets first. The screen creates them itself, cycling the status and marking every third one urgent:

The Support overview screen: tiles reading All tickets 24, New 8, Active 8, Resolved 8; a bar chart with three equal bars; a donut of urgent and not urgent; a grid of tickets; and an empty New ticket form

Before you add any, the charts say No tickets yet instead of drawing empty axes. That sentence is part of the drawing, shown only while the total is zero.

Add a ticket from the page

The New ticket panel is the table's own quick create form. Its fields, its required rules and its business rules are the same ones the table has everywhere:

The Every ticket grid beside the New ticket form, filled in with Summary Printer on the second floor is out of toner, Status New and Urgent ticked

Save it, then press Refresh. The tiles, the chart and the grid all move together:

After Refresh: All tickets 25, New 9, the New bar now taller than the others, and the printer ticket at the top of the grid, with Saved successfully and Refreshed messages

Press a row in the grid and the ticket's form opens in the panel, with a back arrow to return to the list:

The Every ticket panel showing the ticket's form: a back arrow, Save and Save & Close, and the title Ticket - Printer on the second floor is out of toner

How the numbers are counted

Open the app in the Application Studio and press </> to write code. The screen's Screen opens handler runs one query per number:

The code page for Screen opens: six loadRecords lines on par_ticket, each with top 1, some with a where condition on par_status or par_urgent, and countInto naming total, statusNew, statusActive, statusResolved, urgent and calm

countInto is where the number of matching rows goes, not the number that came back. top: 1 keeps the page of rows as small as it can be, because nobody reads it. Each tile's big number is then a text bound to text(state.total), text(state.statusNew) and so on.

The Refresh button runs the same six lines again.

Charts

Components → Chart draws the platform's own chart: bars, stacked bars, line, area, pie or donut. Its Value is a list of labels and numbers built from those counts:

The code page for the chart's Value binding: a list of three items, label New with value state.statusNew, label Active with state.statusActive, label Resolved with state.statusResolved

You draw where the chart goes and how big it is. The chart itself decides the ticks, the labels and what to do with an odd value, every time it draws, so it copes with data you didn't design against.

The grid and the form are the real ones

Components → Table view or form embeds a model-driven surface. Shows picks a view's rows, a form for a new record, or a form for one record; Table and View (or Form) name what to show:

The Screen properties of the grid panel: Shows A view's rows, Table par_ticket, View left empty, with the note that an empty view or form means the table's default

What appears is the same grid a model-driven app shows, with its own sorting, paging and permissions per record, and the same quick create form. Nothing is redrawn, so a field that is required on the table is required here too.

Your own queries don't reach inside those surfaces. After a handler writes records, it ends with reloadSurfaces(), which starts every embedded grid and form again.

While writing this we found that Add 24 tickets left the grid empty beside tiles reading 24. Record writes wait until the handler finishes, but reloadSurfaces() ran straight away, so the grid reloaded before any ticket existed. It now waits its turn like the writes do, and the grid fills in with the tiles. We also found the sample had no quick create form or view of its own, so its New ticket panel said there was nothing to show. Version 1.1.0 of the sample has both.

Put it in an app

A screen nobody can reach isn't much use. Open your solution's Apps, create or edit an app, and in a navigation group press the screen button (the window glyph, beside the table button). We made a Support desk app with the screen and the Ticket table, and chose the screen as the Home page:

The app's navigation group Support holding Support overview (par_dashboard, Screen) and Ticket (par_ticket, 2 forms, 1 views), with Home page set to Support overview

Open the app and it starts on the numbers, with the full list one click away in the rail:

The Support desk app in the Platform Shell: the rail shows Home, then a Support group with Support overview selected and Tickets beneath it, and the dashboard fills the page

The screen and the app travel in their solutions like any other component, so exporting to test and production takes the dashboard with it.

Next: show who created or changed a record.