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.

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:

  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. Run or test your query. Before you can reference sub-content fields, Matik needs to detect the columns your query returns. Open your DC and run or test the query 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 tested or run your query 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

Indexing sub-content

When creating DC that uses sub-content, you have the option to "index sub-content". You can access this feature in the bottom right of your Dynamic Content page, after clicking the caret on the "Test API" button (see below).

The index sub-content button

You can think of sub-content indexing as a way of updating Matik's awareness of what a DC returns when it is queried. (This awareness supports features like tab autocompletion.)

As a rule of thumb, you may want to index sub-content whenever you make a change to a DC that will change the set of column names returned.

Alternatively, if what Matik is showing as the sub-content columns (for example in drop-downs listing your available DC) is different from what you'd expect, you can (re-)index to update what Matik knows about the DC.

Sub-content is typically indexed automatically when you create or update a DC. An exception is when a query contains inputs (&:input) or nested DC ({{dc}}), manual indexing is required.

Limitations

  • Your query must return only one row in order to use sub-content. 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

  • Dynamic Content Overview
  • Data Source Permissions

Articles in this section

  • Dynamic Content Overview
  • AI Descriptions
  • Using Automated Insights Dynamic Content
  • Working with Images in Dynamic Content
  • Connecting Charts to Dynamic Content in Templates
  • Formulas DC
  • Sub-Content
  • Rich Text Formatting
  • Using Nested Dynamic Content in SQL Based Dynamic Content
  • Using Matik Logos as a Dynamic Content Data Source
  • 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.