Skip to main content
Matik Help Center home page Help Center
Matik Blog Case Studies
  1. Matik
  2. Building Templates
  3. Dynamic Content

Sub-Content

Sub-content (or subcontent, without the dash) allows you to use a single piece of Dynamic Content (DC) to power multiple tags within a template. Instead of creating separate DC for each metric or value, you can create one DC that returns multiple columns, then tag each column individually using dot notation.

Insights Dynamic Content can use sub-content too, but you declare its fields yourself instead of getting them from a query. See Sub-content in Automated Insights Dynamic Content.

How it works

Let's say you have a DC called company_seat_stats that runs the following query:

-- dynamic content name: company_seat_stats
SELECT
        company_name,
        purchased_seats,
        activated_seats,
        active_seats
FROM postgresql.public.qbr_data
WHERE company_name = &:client_name
        and contract_id in &:contract_ids
        and quarter = &:qbr_date
        and time = 'Quarterly'

As we can see, the query returns a single row with four columns. Sub-content allows you to tag each column on its own in your template using this syntax:

{{dynamic_content_name.column_name}}

For example: {{company_seat_stats.purchased_seats}}

Note that column_name is case-sensitive and cannot contain spaces.

By specifying the column name in a tag, you are telling Matik to insert only that specific value from the results, rather than the entire row.

Setting up and using sub-content

Follow these steps to start using sub-content in your templates:

Note: These steps cover DC that get their columns from a query. For Insights DC, you declare your fields in the DC editor instead, and there is no query to run first. See Sub-content in Automated Insights Dynamic Content.

  1. Create your DC. Create a Text or Image DC with a query that returns multiple columns. Make sure your query returns only a single row — sub-content does not support queries that return multiple rows.
  2. Save and test your DC. Before you can reference sub-content fields, Matik needs to detect the columns your query returns. Click Add (or Update) to save your DC, then click Test at least once. Matik will then recognize the available column names and make them referenceable via dot notation.
  3. Reference sub-content in your template or configuration. Once your query has been run, you can reference individual columns anywhere sub-content is supported using this syntax: {{dynamic_content_name.column_name}}. 
    • For example, if your DC is called company_seat_stats and has a column called purchased_seats, you would use {{company_seat_stats.purchased_seats}}
    • Remember that column_name is case-sensitive and cannot contain spaces.

In some places, Matik will present available sub-content fields in a dropdown menu. In these cases, instead of manually typing dot notation, select your desired DC from the dropdown list, and then click "Show Sub-content" and select your desired field. 

Sub-content select dropdowns are available when:

  • Tagging presentation templates in single slide view
  • Adding slide conditions, generate conditions, send conditions, or triggers
  • Adding Image DC to Mail templates in the Visual Builder
  • Configuring outputs in Conditional DC
  • When using the Form in Insights DC

In other cases (primarily when using a query or text editor in Matik), reference sub-content by using dot notation. 

  • For example, type {{DC_name.col1}} in a SQL query to insert the col1 field of the DC_name DC.
  • While you can always type the DC name manually, Matik also offers auto-complete suggestions to help you. When you start typing {{ in a query editor, the auto-complete will show relevant DC. You click a DC or its subcontent to fields to automatically insert the correct dot notation. 

Troubleshooting tip: if you do not see your sub-content fields in the selector, make sure you have saved your DC and tested it at least once.

Where you can use sub-content

You can use sub-content in the following places:

  • Template tags — Reference individual columns directly in your templates. Sub-content is supported in all template types
  • Conditions — Reference sub-content as the value to compare against in slide conditions, send conditions, and generate conditions 
  • Conditional DC— Select a sub-content field as one of the possible outputs of a Conditional DC
  • Within DC. For example:
    • Automated Insights — Specify a sub-content field as the input for Describe, Analyze, Summarize, or Compare actions, or reference {{DC_name.col1}} directly in a free text prompt
    • Spreadsheets DC sheet inputs — Use {{DC_name.col1}} to insert data into the spreadsheets DC
    • Logo DC — Reference {{DC_name.col1}} when configuring a Logos DC
    • Query-based DC - reference {{DC_name.col1}}  directly in your SQL/SOQL query

How Matik detects sub-content columns

Matik detects sub-content columns automatically. There is no separate indexing step.

  • When you save. When you click Add or Update, Matik runs the query in the background and records the columns it returns. Queries that contain inputs (&:input) or nested DC ({{dc}}) are skipped at this point, because they need values to run.
  • When saved DC runs. Matik refreshes the columns whenever the saved version of the DC runs successfully: when you click Test on a DC with no unsaved changes, and when a presentation is generated. This is how DC with inputs or nested DC get their columns.

If you change the query, click Update before you click Test. Testing unsaved changes does not update the columns.

Insights DC declare their fields instead of detecting them, and static DC (Use static value) have no query to detect columns from.

Limitations

  • Your query must return only one row in order to use sub-content. (This applies to DC that use a query. Insights DC declare their fields instead.) Returning multiple rows in your sub-content query can lead to generation errors or unexpected data population.
  • Column names are case-sensitive and cannot contain spaces.

Was this article helpful?

Have more questions? Submit a request

Related articles

  • Connecting to Microsoft 365
  • Dynamic Content Overview
  • Tags Overview
  • Using Nested Dynamic Content in SQL Based Dynamic Content
  • Inputs Overview

Articles in this section

  • Using Matik Analytics as a Data Source
  • [BETA] Draft Versions for Dynamic Content and Inputs
  • Using Asana in Dynamic Content
  • Dynamic Content Overview
  • Version History for Dynamic Content
  • AI Descriptions
  • Using Automated Insights Dynamic Content
  • Working with Images in Dynamic Content
  • Connecting Charts to Dynamic Content in Templates
  • Formulas DC
  • See all articles

Comments

0 comments

Article is closed for comments.

Personalize data-driven content in minutes

Product

  • How it Works
  • Integrations
  • AI Features
  • Security

Solutions

  • Sales
  • Customer Success
  • Ops & Strategy
  • Data

Resources

  • Blog
  • Templates
  • AI + CS Resource Hub
  • Case Studies
  • Help Center

Company

  • About Us
  • Careers
  • Terms of Service
  • Privacy Policy

© 2024 Matik, Inc.