Building Components

Components are the tiles on your dashboard — a headline number, a table, a chart, or a block of your own design. This guide takes you from a blank screen to a working component on a dashboard, with no developer required.

Before You Start

Building components is an admin job. You need the Administrators role in MinistryPlatform, or one of the extra admin roles your church has configured. Everything lives under the admin area, on two tabs: Queries and Components.

It helps to know roughly where your data lives in MinistryPlatform — for example that events are in the Events table — but you don't need to memorize anything. Both builders have a search box that lists your real tables, columns and stored procedures as you type, and there is an AI assistant that will find them for you.

How It Fits Together

PastorApp splits a dashboard tile into four separate pieces. Each one does one job, and each one is saved on its own so it can be reused:

  • A query fetches the data from MinistryPlatform. It knows nothing about how the data will look.
  • A transform (optional) reshapes what came back — trims it down to the fields you want, filters rows, or boils a list down to a single number.
  • A component points at one query, carries the optional transform, and decides how the result is presented: stat, table, chart or custom template.
  • A dashboard is where a component is placed, sized and arranged. The same component can sit on many dashboards.

That separation is the thing worth remembering. One query about upcoming events can feed three components — a count, a table and a bar chart — and if the query changes, all three follow. It also means a component is never edited on a dashboard: you edit the component, and every dashboard showing it updates.

When a dashboard tile loads, PastorApp runs the query, applies the transform, then hands the result to the presentation. If you ever get a surprising result, work back along that chain in the same order.

Step 1: Build a Query

Go to Admin > Queries and choose Manual. Give the query a clear, unique name — you will be picking it out of a list later — and a description your successor will thank you for.

Two Kinds of Query

  • Table query — you pick a MinistryPlatform table and describe which columns and rows you want. This covers most needs.
  • Stored procedure — you call a report that already exists in your MinistryPlatform database, and supply its parameters. Use this when the logic is complicated enough that somebody has already written it in SQL.

The form changes to match your choice. You cannot save a table query without a table, or a stored-procedure query without a procedure.

Filling In a Table Query

  • Table Name — start typing and pick from the list of real MinistryPlatform tables.
  • Select Fields — a comma-separated list of columns. Leave it empty to get everything, which is fine while you are exploring and wasteful once you are finished.
  • Filter Conditions — which rows to keep, written the way MinistryPlatform writes them (the part that would follow WHERE), for example Events.Cancelled = 0.
  • Order By / Group By — sorting and grouping, again in MinistryPlatform's own syntax, such as Event_Start_Date ASC.
  • Top and Skip — a row limit and an offset. Setting a Top is a kindness to everyone: a component that quietly pulls fifty thousand rows is slow for every person who opens the dashboard.
  • Select Distinct — drop duplicate rows.

Column names in MinistryPlatform are capitalized with underscores — Contact_ID, First_Name, Event_Start_Date — and they are case-sensitive. To reach a column on a related table, walk the link with the _Table suffix: Congregation_ID_Table.Congregation_Name gets you the campus name from an event.

Filling In a Stored Procedure Query

Pick the procedure from the search box and PastorApp reads its definition and fills in the parameter names for you. You then supply a value for each one. Parameters accept plain values or tokens (below).

If the procedure's name ends in _JSON, PastorApp assumes it returns a block of JSON rather than ordinary rows, and unpacks it for you automatically before anything else sees it.

Tokens: Making a Query Personal

A token is a placeholder that PastorApp swaps for a real value when the component runs, so one saved query can show a different answer to each person. In the Select Fields, Filter Conditions and stored-procedure parameter boxes they are highlighted in blue as you type them, so you can see at a glance that PastorApp recognizes one. Two tokens are available:

  • {{dp_UserID}} — the numeric MinistryPlatform User ID of whoever is looking at the dashboard.
  • {{dp_UserName}} — that person's MinistryPlatform username.

So a filter of Primary_Contact = {{dp_UserID}} gives every staff member their own list from a single saved query. Tokens work in Select Fields, Filter Conditions, Order By and Group By on a table query, and in any stored-procedure parameter value.

Who Sees Which Rows

By default a table query runs as the person looking at it. PastorApp tells MinistryPlatform who is asking, and MinistryPlatform applies that user's global filter — at most churches, their campus or parish. Two people can open the same component and honestly see different numbers, and that is usually what you want.

There is a single, deliberate exception: the checkbox labeled “Show organization-wide data (ignore each viewer's MinistryPlatform scope)”. Check it and the query runs unscoped, so everyone who can see the component sees the whole organization — including records they could not otherwise reach. It is off by default on every query, new and old. Reserve it for genuine whole-church totals, and read the sentence the form shows you once it is checked.

Stored procedures work differently: they are not run as the viewer at all. If a procedure needs to know who is asking, pass {{dp_UserID}} into one of its parameters.

Dashboard Filters (Filterable Dimensions)

A dashboard can carry a filter bar for three things: Congregation (Campus), Program and Ministry. A query only joins in if you tell it how each of those maps onto its own data, which is what the Filterable Dimensions section is for.

  • On a table query, check the dimension and give the column, for example Events.Congregation_ID.
  • On a stored procedure, check the dimension and choose one of the procedure's parameters, such as RestrictCampusID (without the @).
  • Field Kind is Single id unless the field genuinely holds a list of ids — a volunteer serving several campuses, say — in which case choose Array of ids.

Declaring nothing is fine; the query simply ignores dashboard filters. But note that a user's restrict to campus setting can only be enforced on a query that has declared its congregation mapping, and that restriction always wins over anything chosen on the dashboard.

Who May Use It, and How Long It Is Cached

Allowed Roles limits the query to people holding one of the MinistryPlatform roles you list. Leave it empty and everyone may use it. This is the control that decides who finds the finished component in the dashboard catalog, so set it here rather than hoping nobody looks.

Cache Duration is how long PastorApp may reuse a result before asking MinistryPlatform again: None, Short (1 minute), Normal (3 minutes), Medium (5 minutes) or Long (10 minutes). Normal is the default and suits almost everything. Cached results are kept per person, so caching never leaks one user's rows to another.

Preview It

Save the query, then press Preview Query. It runs for real, as you, and shows the rows in a grid plus the raw result in a JSON tab. The JSON tab matters more than it looks: the field names you see there are exactly the names you will type into the component later.

The Preview button only appears once the query is saved and has no unsaved edits — if it has vanished, you have changed something since your last save.

Where Your Queries Live

The query list has tabs and a badge on every row:

  • Global — a shared library query that ships with PastorApp. You cannot edit these, by design. Press Clone to Customize to get your own copy.
  • Derived — your copy of a library query. Edit it freely; the original is untouched.
  • Custom — one you wrote from scratch.

A query that is in use tells you which components depend on it, and refuses to be deleted until they are gone. That is a feature — it is how you avoid breaking somebody's dashboard on a Tuesday morning.

Step 2: Reshape the Data (Optional)

Often the query result is already the right shape and you can skip this entirely. Sometimes it is not: you want four fields out of thirty, or you want a count rather than a list. That is what a transform does.

Transforms are written in JMESPath — a small, standard language for picking things out of JSON. Think of it as a formula language for data, the way a spreadsheet formula is for cells. It is saved on the component, not the query, so two components can take the same query in different directions.

A transform is stored as two fields: the engine (always jmespath) and the expression. It only runs if both are filled in; leave either blank and the component renders the untransformed data.

{
  "engine": "jmespath",
  "expr": "[*].{Name: Display_Name, Email: Email_Address}"
}

Worked Examples

Suppose your query returns rows that look like this:

[
  {
    "Event_ID": 4821,
    "Event_Title": "Sunday Worship",
    "Event_Start_Date": "2026-09-20T09:00:00",
    "Congregation_ID": 1,
    "Congregation_Name": "North Campus"
  }
]

Then:

  • Keep two fields and rename them:
    [*].{Event: Event_Title, Campus: Congregation_Name}
  • Keep only one campus:
    [?Congregation_Name == 'North Campus']
  • Count the rows, for a stat:
    {count: length(@)}
  • Newest first:
    reverse(sort_by(@, &Event_Start_Date))

Three details trip people up. Square brackets with a question mark, [?...], filter rows. Curly braces build a new row out of old fields, with the new name on the left. And a literal number must be written between backticks — `0`, not 0.

PastorApp adds two functions of its own for working with dates:

  • daysUntilDate(date) — how many days from today until that date. Past dates come back negative.
  • isDateToday(date) — true if the date is today.

So “everything in the next 30 days” becomes a single expression:

[*].{Event: Event_Title, Days: daysUntilDate(Event_Start_Date)} | [?Days >= `0` && Days <= `30`]

The | is a pipe: work out the left-hand side first, then apply the right-hand side to that result.

You do not have to write any of this by hand. The component editor has an AI Transform Designer: describe what you want in plain English — “just the name and email, sorted by last name” — and it writes the expression, then shows you the original and transformed data side by side so you can check it. Press Run Transform to re-check at any time.

Step 3: Build the Component

Go to Admin > Components and choose Manual. Name it, then pick the query it should use from the search box. Once a query is selected, the rest of the form comes to life.

Choosing a Type

  • Stat Card — one headline number, optionally with a change figure beneath it. Needs a single object, not a list, so a count usually needs a transform first.
  • Table — rows and columns, sortable and paginated.
  • Bar Chart — categories along the bottom, one or more numeric series, optionally stacked.
  • Line Chart — the same, drawn as lines. Good for anything over time.
  • Pie Chart and Donut Chart — one set of numbers as slices of a whole.
  • Template — your own HTML layout, for when none of the above will do.

Those seven are the complete list. Charts need a list of rows where each row has a category and at least one number, which is very often what the transform is for.

Stat Cards

A stat needs a value path: the name of the field holding the number. If your transform produced {"count": 42}, the value path is count. You can also set:

  • Format — number, currency or percent.
  • Color — blue, green, red, yellow, purple, orange or gray.
  • Color rules — change the color based on the value, for example green above 100 and red at or below it.
  • Alignment, and whether the icon sits to the left or on top.
  • A delta path — a second field shown as a change figure.

One warning worth repeating: the component heading comes from the component's Display Title. Setting a title inside the stat configuration as well gives you the same words twice.

Tables

A table needs at least one column, and each column needs a header (what people read) and a path (the field name in the data). You can also set a width, an alignment, and a format of text, number, currency, percent or date. On top of that:

  • Default sort — which column to sort by, and which way.
  • Pagination — rows per page (25 if you say nothing).
  • Empty state — either show a friendly message you write, or hide the whole component when there is nothing to show. Hiding is the neater choice for a “things needing attention” list.

If your data is not a plain list but a list tucked inside an object, set Source Path to the field that holds it.

Charts

Pick the category field (the x-axis, or the slice name on a pie) and one or more series — the numeric fields to plot. The dropdowns are filled from your real data, so if a field is missing from the list, your transform has not produced it.

Each series can take a label and a color from blue, green, red, yellow, purple, orange or gray; leave the color empty and PastorApp cycles through its own palette. Bar charts can be stacked. Legend and grid can be switched off, and values on the axis and tooltip can be formatted as number, currency or percent.

Templates (Liquid)

A template component lets you write the HTML yourself, using Liquid — a simple, safe templating language. Anything in double curly braces is printed; anything in curly-brace-percent is a loop or a condition.

Your query result arrives as data. If it is a list, loop over it; if it is a single object, you can reach its fields through data or by name directly.

{% for item in data %}
  <div class="p-3 border rounded-lg">
    <strong>{{ item.Event_Title }}</strong>
    <span>{{ item.Event_Start_Date | format: "date" }}</span>
  </div>
{% endfor %}

Four filters are available:

  • format — formats a value as currency, number, percent, date or text.
  • get — reads a nested field by path.
  • json — prints the raw value as JSON, which is invaluable while you are working out what you have.
  • number_with_delimiter — 1234567 becomes 1,234,567.

Every value you print is HTML-escaped, so a name or a title always shows as the text it is, never as markup. Write your HTML in the template itself. When a field really holds HTML, end it with | raw — {{ item.Body | raw }} — to print it as HTML. Either way the rendered result is sanitized: anything dangerous, such as scripts and event handlers, is stripped.

Under Empty State Handling you choose between a friendly message and hiding the component. Under Error Handling, choose Show error message while you are building and Hide component or Use fallback HTML once you are live. Fallback HTML is shown in place of the template whenever it fails — a short “check back later” note, say — and is sanitized like the template itself. The full error appears only in the builder's preview; people viewing a dashboard see just “This template couldn't be rendered.”

If you only need part of the data, set Source Path to the field that holds it — summary, or a dotted path such as report.rows. The template then receives that value as data instead of the component's full data. Leave it empty to get everything. When the path finds nothing, the template counts as empty and follows your Empty State Handling.

Making a Component Clickable

Stats and tables can take a click action that sends the user to a page. The address must be an internal route starting with /, such as /contacts, or an external address starting with https://.

Addresses can carry the data with them. On a stat, {{value}} is replaced with the number shown. On a table column, {{row.Field_Name}} is replaced with that field from the row the person clicked — so a contacts table can link each row to that person's profile.

Title, Icon and Tags

Display Title is the heading on the component; without one the component shows no heading at all. Icon picks an icon shown on stat cards. Tags are purely for your own filing.

Campus Priority

Users can set a priority campus in their own settings. Where a component knows which campus each row belongs to, rows for that campus float to the top of the list — nothing is hidden, the order just puts the relevant rows first.

Most of the time this needs no setup: if the query declared its congregation column under Filterable Dimensions, PastorApp works the field out for itself. Switch on Sort by priority campus and name the field only when it cannot — typically when a stored procedure returns a list of campus ids per row (check Field is an array of ids), or when your transform renamed the field. If your transform drops the congregation id altogether, the sort has nothing to work with; keep the field in the transform output.

Preview It

Save, then press Preview Component. You get the component rendered exactly as it will appear on a dashboard, alongside the underlying query results, so you can see at a glance whether a blank tile is a data problem or a presentation one.

Step 4: Put It on a Dashboard

Components do nothing until they are placed. Open your dashboard and use the dashboard menu in the top right.

  1. Choose Edit Dashboard. The tiles unlock.
  2. Press Add Component, search for yours by name, and add it. Components you have already placed are not offered again.
  3. Drag tiles to move them and drag a corner to resize. The layout saves itself, and is remembered separately for wide, medium and narrow screens.
  4. Press Done.

You can keep as many dashboards as you like — New Dashboard in the same menu creates one, and the dropdown switches between them. One is marked with a star as your default; that is the one you land on. Use Set as default while editing to move the star.

While editing you also choose which filters this dashboard offers — campus, program, ministry. The filter bar then appears above the tiles for everyone using it, and applies to every component whose query declared that dimension. Components that did not declare it simply ignore the filter.

Two things to keep in mind. A component only appears in the catalog for people who hold one of the query's Allowed Roles. And Delete while editing removes the dashboard, not the component — your component and query remain in the admin library.

A Complete Example

Let us build “Upcoming Events”: a table of everything on the calendar in the next 30 days, filtered to the viewer's campus. These are the actual values to type.

The Query

Admin > Queries > Manual. Query Type: Table Query.

  • Query Name: Upcoming Events
  • Table Name: Events
  • Select Fields:
    Events.Event_ID, Events.Event_Title, Events.Event_Start_Date, Events.Congregation_ID, Congregation_ID_Table.Congregation_Name
  • Filter Conditions: Events.Cancelled = 0
  • Order By: Event_Start_Date ASC
  • Top: 500
  • Cache Duration: Normal (3 min)
  • Filterable Dimensions: check Congregation (Campus), MP Column Events.Congregation_ID, Field Kind Single id (scalar)
  • Leave “Show organization-wide data” unchecked — each person should see their own campus.

Save, then Preview. The JSON tab should show rows like the example earlier in this guide.

The Component

Admin > Components > Manual.

  • Component Name: Upcoming Events Table
  • Query: Upcoming Events
  • Component Type: Table
  • Display Title: Upcoming Events

For the transform, paste this into the Transform Configuration box (or type “only events in the next 30 days, with days remaining” into the AI designer and check what it writes):

{
  "engine": "jmespath",
  "expr": "[*].{Event: Event_Title, Starts: Event_Start_Date, Campus: Congregation_Name, Congregation_ID: Congregation_ID, Days: daysUntilDate(Event_Start_Date)} | [?Days >= `0` && Days <= `30`]"
}

Note that Congregation_ID is carried through even though no column shows it — that is what lets the priority-campus sort work.

Then the presentation configuration:

{
  "columns": [
    { "header": "Event", "path": "Event", "format": "text", "align": "left" },
    { "header": "Date", "path": "Starts", "format": "date", "align": "left" },
    { "header": "Campus", "path": "Campus", "format": "text", "align": "left" },
    { "header": "Days away", "path": "Days", "format": "number", "align": "right" }
  ],
  "defaultSort": { "path": "Starts", "dir": "asc" },
  "pagination": { "pageSize": 10 },
  "emptyStateOptions": {
    "behavior": "show",
    "message": "Nothing on the calendar in the next 30 days."
  }
}

Save and press Preview Component. You should see a sorted, paginated table of the next month.

A Second Component From the Same Query

To add a “this week” number beside it, create another component on the same query with type Stat Card, this transform:

{
  "engine": "jmespath",
  "expr": "{count: length([*].{Days: daysUntilDate(Event_Start_Date)} | [?Days >= `0` && Days <= `7`])}"
}

and this presentation:

{
  "valuePath": "count",
  "format": { "value": "number" },
  "color": "blue",
  "align": "center"
}

Place Them

Open your dashboard, choose Edit Dashboard, Add Component, add both, size the stat small and the table wide, and press Done. While still editing, switch on the Congregation filter so viewers can change campus from the bar above the tiles.

Letting the AI Build It

Both builders have an AI assistant that does the whole job through conversation, and they are genuinely the fastest route for a first component.

  • Admin > Queries > Create with AI — describe the data you need. It searches your real MinistryPlatform tables and stored procedures, drafts the query, runs it against live data to check the shape, proposes the dashboard-filter mappings, shows you the rows, and saves it under a name you choose. It will ask rather than guess when a campus or ministry mapping is ambiguous, and it tells you which ones it could not map.
  • Admin > Components > Create with AI — pick a saved query and describe the component. It inspects the real results, recommends a type and says why, writes the transform and the presentation, and renders a preview you can iterate on.

Reach for the wizard when you are starting from scratch or are unsure which table holds what; use the ordinary editor when you know exactly what you want to change. Anything the AI produces is an ordinary saved query or component, editable by hand afterwards. Always look at the preview before saving — it is your data, and you are the one who knows whether the answer is right.

When Something Does Not Work

The preview button is missing

Previews run against the saved record. Save first; if you have edited anything since saving, the button hides until you save again.

The query preview shows an error

The message comes back from MinistryPlatform and is usually specific. The common causes are a misspelled column (they are case-sensitive), a related column used without the _Table suffix, or filter syntax that is not valid SQL. Fix, save, preview again.

The query runs but returns no rows

The filter may genuinely match nothing — or the rows exist but lie outside your own MinistryPlatform scope. Remember the query runs as you. Check the same filter in MinistryPlatform before assuming PastorApp is wrong.

The transform returns nothing, or null

Nearly always a name or a shape. Open Sample Data in the designer and compare your field names against it, character for character. Check that literal numbers are inside backticks. And check the shape: a table or chart needs a list, while a stat needs a single object — {count: length(@)} produces an object, length(@) on its own produces a bare number the stat cannot read.

The component is empty but the query has data

The presentation is looking for a field that is not there. Two things to check: the paths are the field names after the transform, not before; and if your data is a list wrapped inside an object, the table or chart needs its Source Path set to the field containing the list. On a template, a Source Path that names a missing field makes the template empty.

The stat says N/A

The value path found nothing. Usually the data is still a list — add a transform that produces a single object.

A stored procedure parameter seems to be ignored

Parameter names must match the procedure exactly; the safest route is to re-select the procedure from the search box, which fills the names in for you. If you expected the parameter to carry the current user, check that you typed the token exactly as {{dp_UserID}} — it will be highlighted in blue if PastorApp recognizes it.

Everyone sees the same numbers, or different ones, unexpectedly

Check the “Show organization-wide data” checkbox on the query. Checked, everyone sees the whole organization; unchecked, each person sees only what MinistryPlatform allows them. Stored-procedure queries are never scoped to the viewer automatically.

My component is not in the Add Component list

Either it is already on that dashboard — placed components are not offered twice — or the query's Allowed Roles exclude you.

The numbers are stale

Results are cached for the query's Cache Duration. Wait it out, or set the duration to None while you are testing.

The template shows “Template Error”

Liquid could not render what you wrote; in the builder's preview the message names the problem. (On a dashboard the same failure reads “This template couldn't be rendered.” — open the component in the builder to see why.) The usual culprits are an unclosed {% for %} or {% if %}, or a filter name that does not exist — only format, get, json and number_with_delimiter are available.

Where to Go Next

The Administration guide covers the rest of the admin area — branding, roles, and what else you can configure. The Features Overview shows what PastorApp offers out of the box, and the FAQ answers the questions that come up most often.