BETA: Working with dynamic data sources

A dynamic data source is a data source which uses one or more variables in its query instead of hard-coded values, thereby enabling the ability to dynamically retrieve data. Learn more about variables here.

Dynamic data sources offer a solution for users who need more flexibility in working with large amounts of data or data that requires multiple instances.

Important notes

Please note the following when working with dynamic data sources:

  • Dynamic data sources are typically used for pagination, combining data sources, dynamic dashboards, and date queries.
  • Dynamic data sources should NOT be used to implement security. They are variable driven and variable values can be accessed through different features, for example, permalinks, where all the variables and values are included in the URL. If you want to implement security to prevent users from accessing your data, create a specific data source with the parameters and values set in the data source definition, without using variables.
  • Modelling dynamic data sources is not currently supported.
  • When creating a dynamic data source, you have to specify any dynamic parameters directly in the Query URL.  You cannot use the Query Parameter fields.

This article includes:

Setting up a dynamic data source

A common use for dynamic data sources is accessing a list from a data source, for example, Google Analytics profile IDs, Facebook Ads campaigns, or Google Ads Manager Account client IDs, and displaying the data for each item in the list. You can do this effectively with dynamic data sources instead of creating a separate data source for every ID in your list.

You can also use dynamic data sources with SQL databases. Any parameter in the WHERE clause can be used as the dynamic variable and also any value in the host, port numbers, usernames, and password fields.

This example describes how to create a dynamic data source that displays data for each Facebook Ads campaign:

  1. In the Klip Editor, at Advanced Tools, click Create new variable and enter a value, for example, a variable called campaignID with the value set to a campaign ID, for example, 1234567.

    Note: The variable used in a dynamic data source must be set to a value that will return valid results when used in the data source query.

  1. Create a new data source and use the variable you created in the Query URL with the correct formatting. In this example, we use the Facebook Ads connector and enter the variable in place of a hard-coded value, using the format {props.campaignID}. For example:

https://graph.facebook.com/v19/1234567/insights?fields=impressions,name,ad_id&level=ad

Replace 1234567 with {props.campaignID}.

The query will look like the following:

https://graph.facebook.com/v19/{props.campaignID}/insights?fields=impressions,name,ad_id&level=ad

  1. To create a list of values like campaign IDs, build a drop-down User Input Control component to select the campaign IDs from and enter the list of values you want to select from in the Values sub-component.
  2. Set the variable in the User Input Control to the same variable you entered in the Query URL. In this example, we use campaignID.
  3. Build a Klip, with a Table component, with the data source that was returned when you created the query. Select the columns of data and reference the data as you would with any data source.

When the Facebook Ads Campaign ID is selected from the User Input Control, a dynamic data source instance is created and the table or any component automatically responds to display the data for the Facebook Ads Campaign ID selected.

Troubleshooting dynamic data sources 

Following are some troubleshooting ideas for your dynamic data sources. If, after going through this section, you still need debugging assistance, contact support@klipfolio.com.

What do I need to know about dynamic data sources with multiple variables?

Dynamic data sources can have multiple variables associated with them. If these variables are set to an invalid combination, an invalid data source instance will be created. To prevent invalid combinations of variables, the User Input Control components that set these variables should be associated with a Button component configured to co-ordinate the setting of these variables. This enables better Klip performance and avoids unnecessary formula execution.

How do I know if my dynamic data sources are failing?

You can quickly see a list of your dynamic data sources that are failing to refresh.

If you see a red icon in the left navigation bar (beside Data Sources) that means you have at least one data source that is failing to refresh. (Learn how to view clients’ failing data sources here.)

Clicking the red icon opens your list of data sources with the Failed Data Sources filter applied. (You can also access this list by clicking Data Sources in the left navigation bar and then selecting Failed Data Sources from the filter drop-down list.)

All the data sources that have failed to refresh are listed with their Last Refresh date. If you are unsure which of your data sources are dynamic data sources, click the red exclamation mark beside the Data Source Name (see below) to go directly to its About this Data Source page. If it’s a dynamic data source, the page will not include the Download Data option.

If a dynamic data source(s) is failing, you can resolve this issue by going to its debug_info page and removing the failing data source instance using the “x”. (See the following section of this article for more detail.) If the failing instance re-appears, you will need to investigate the cause. For example, it could be due to incorrect variable options or variable values in the Klip Editor or a problem in the formula.

How do I access debug information?

If you are having issues with your dynamic data sources, you can use our debug_info pages to help you resolve them.

To access the debug_info pages:

  1. In the left navigation sidebar, click Data Sources.

If you don’t see the above option, go to the bottom of the left navigation sidebar and click your Account Name > Data Sources instead.

  1. From the list of data sources displayed, select the dynamic data source to open its About this Data Source page. A data source can be identified as dynamic if the Download Data option is not displayed.
  2. In the URL displayed in the browser address bar, replace view with debug_info.
  3. Scroll down to the Instances section. This is a list of the individual dynamic data source instances, each with its unique ID, variable (prop:<variable>) setting and refresh information.
  4. Check for dynamic data source instances with the following issues:
    • invalid or missing variable setting
    • empty last refresh value
    • small data size
    • refresh fail count with a non-zero value
  5. For each invalid dynamic data source instance, select one of the [ x | refresh | data ] actions displayed next to its identifier.
    • click data to view the dynamic data source instance and assess the contents
    • click x to delete the dynamic data source instance (this will delete only the specific instance, not the entire data source)
    • click refresh to refresh the dynamic data source instance

Following are some examples of errors and suggestions for resolution:

Related Links

Have more questions? Submit a request