Skip to main content

Use Query Results in Text

One effective (and underappreciated) way of presenting data is to simply include it in text. Despite what your BI sales rep might tell you, the written word is still one of the most powerful and accessible communication tools.

Include a Value In Your Text

Evidence's <Value/> component lets you include the result of a query directly in the text on your page.

Copy and paste the sentence below into your markdown file.

Add to business-performance.md below the 'monthly_orders' query:
The most recent month of data began <Value data={data.monthly_orders} fmt=date/>,
when there were <Value data={data.monthly_orders} column=orders/> orders.

Result:

summary-sentence

These values will continue to update as the results of your SQL query change, for example, if more recent data is added.

Updated Page

Here's what our page looks like now:

after-add-sentence

Now that we have our query results showing up directly in the text of our page, we don't need our audience to see the underlying data or code.

Hide Sources

Evidence lets you choose what's visible with the Show/Hide Sources button at the top of each page. Click that button to hide the sources and make the page look cleaner:

show-hide-sources

When you are in development mode, queries are shown by default. In production, queries are hidden by default.

Anyone reading the page can still look at the queries by clicking Show Queries. We think this will be powerful for analysts who want to understand how a metric was calculated or see the source data behind a number.