Build a query across tables, step by step
Answer "which open matters, for which clients, in which city, and which have no task yet" in one list, without a report writer. In this guide you build that query, run it, count it by group, and keep it as a view.
Several tables in one request, with a warning when the rows won't mean what you think.
What the Query Builder is
- A page (Query Builder in the left menu) that reads one main table with columns from its related tables: a matter with its client's name and city, in one row.
- It filters across all the joined tables at once, with the same AND and OR groups as a view, and sorts by any column.
- It keeps only the records that have, or have no, related records (matters with no task, accounts with no contact), and it counts and totals by group.
- Before you run anything it shows notes on what the rows will mean: what your role lets you see, what a join drops, how far you can reach.
- A result can be published as a view, or copied as JSON: the same query a plugin script or the API runs. Or describe it in words and Coin builds it.
Good to know
- It reads strictly as you: two people can get different rows from the same query, each seeing only what they may read.
- A query reaches up to four tables away and reads up to eight tables.
- For a list people open every day, a saved view is lighter: the View Designer builds the same filters and joins.
Before you start
- Every signed-in person can use the Query Builder; it reads strictly as you. Publishing a query as a view needs the right to create views.
- We build: open matters for clients in Larkspur Falls or Harbor Glen, with each client's name and city, then count them by city and keep only those with no task yet.
- Running a query costs nothing. Only the Build query box (Coin) costs money, and only when you press it.
Part 1. Pick the table and the columns
1Open the Query Builder
Open Query Builder from the left menu. The page has three parts, top to bottom: a box to describe what you want in words (Coin writes the query: the last step), the table picker with Run and JSON, and, once a table is picked, the query itself.
Every signed-in person can use it. It reads strictly as you: you see only the rows you may read, and running a query never changes a record.

2Choose the main table: one row per Matter
Open Choose a table and pick the table whose records you want listed: each row of the result is one record of this table. Type the first letters to jump down the list. Here: Matter.

3Tick the columns, and read the notes
The Matter card opens with Name ticked. Tick every column you want to see; here also Record Number.
The lines with an i are notes Codossier Office reads before you run anything. Read them: they say what the rows will mean. You reach every row of matter, as Owner means your role shows you every matter; someone who reads only the matters they work on gets fewer rows from the same query. 4 hop(s) left of 4: a query reaches at most four tables away from the main one. Select all, beside the heading, ticks every column of the table at once; untick it to clear them.

Part 2. Join a related table and filter across tables
4Add a related table
Below the filter, open Add a related table. Two groups:
- From each Matter, look up its…: a lookup on the matter, such as Account (the client company). Its columns join the same row.
- Records that point to this Matter: records that hold the matter, such as its tasks or contacts. On this page they show no column: they decide which matters stay (step 11).
Pick Account and press Add.

5The Account card: its columns and which matters stay
The new card starts with the client's Account Name ticked. Tick Address City too. Then choose which matters stay:
- Every matters: a matter with no client stays, with blank client columns.
- Only matters that have one: a matter with no client, or with a client you may not see, is dropped.
Sort by sorts by a column of this table, after the main table's sort. With no column ticked, the card warns you that it adds nothing to the results.

6Filter across all these tables
Once a table is joined, the main filter is called Filter, across all these tables, and its field list offers the joined columns too: Address City (Account). Build it like a view's filter: Add filter for a condition, Add group for an Any of (Or) or All of (And) group.
Ours: State Is true, and Any of (Or): Address City (Account) Equals Larkspur Falls or Equals Harbor Glen. A filter inside the Account card tests the client alone; here an OR can mix the matter's fields and the client's.

7Sort the rows
Under the cards: Sort by a column of the main table, and Ascending or Descending (click to switch). Beside it, how many tables the query reads (here 2). A query reads up to 8 tables.

Part 3. Run it, keep it, summarize it
8Run it, or see it as JSON
Press Run. The results open below, in the same list a table's page uses.
JSON shows the query as text: the same markup a plugin script or the API runs. Copy it from here, or paste one in and press Load this JSON to open it in the builder. Press JSON again to hide it.

9Read the results, then publish them as a view
The results show one row per matter, with the client's name and city as columns: the four demo matters, A to Z. The list has the usual tools: search, Filter and Export to Excel.
To keep it, type a name in Name this view and press Publish View: the query becomes a view of the Matter table, with its joins, and every list and subgrid on matters can pick it. Publishing needs the right to create views. To change it later, use the View Designer.

10Summarize: count by group
Press Summarize: count and total by group to get one row per group instead of one per record. Pick Group by (here Address City (Account); And by… adds a second), then what to compute: Count records, Count different, Total, Average, Lowest or Highest. Add a total adds another. Keep one column ticked, or Run asks for one.
Here: three open matters for Larkspur Falls clients, one for Harbor Glen. Back to a list returns to rows. A summary cannot be published as a view.

Part 4. Has one, has none, and asking Coin
11Keep only matters with (or without) tasks, and what you will not see
Add a related table from Records that point to this Matter, such as Task (Regarding Record ID). Its card has no columns: it only decides which matters stay. Pick Only matters that have tasks or Only matters with no tasks; add a filter in the card to say which tasks count.
Read its notes before you trust the rows:
- A Regarding can point at several tables, so only the tasks about a matter count.
- A task you may not read is not there for you: a matter whose only task is hidden from you looks like it has none.
- A joined table includes inactive (closed) records unless its filter says otherwise.
Run it: the lease default drops out, because it already has a task.

12Or describe it in words and let Coin build it
Type what you want in the box at the top, in your own words: Open matters for clients in Larkspur Falls, with the client's city. Press Build query and Coin writes the query from the tables' structure and the records you may see, and the page fills with it. Check its tables, filter and notes like any query, and change what is wrong.
Each request costs a few cents of AI use, as the line under the box says, so it is not pressed here. The box works only while Coin is switched on for your office.

What next
- Need the same list every day? Publish it and pick it from the table's view picker, or shape it further in the View Designer.
- The JSON you copy is what a plugin script runs: see Plugin scripts.