HomeGuidesAPILog In

Hierarchical Data

A hierarchical datasource is a data model in which data is stored in the form of records and organized into a tree-like structure, or parent-child structure, in which one parent node can have many child nodes connected through links.

Image from EDUCBA

The hierarchical database model requires that each child record has only one parent, whereas each parent record can have one or more child records, usually in the form of an array or collection of objects.

JSON and XML files often include hierarchical data. In SmartIQ you'll use one of these text based file formats if you are using one of the following Data Sources; JSON, XML, Web Service (SOAP), or REST

It is highly suggested that you go and learn about the intricacies of both file formats and data sources that use them, if you plan to use the data management capabilities of SmartIQ.

Here are two examples of hierarchical data:

<?xml version="1.0" encoding="utf-8"?>
  <student id="0001">
        <name>Nature History</name>
  "students": {
    "student": {
      "-id": "0001",
      "name": "Justin",
      "lastName": "Example",
      "subjects": {
        "subject": [
          { "name": "Science" },
          { "name": "Nature History" },
          { "name": "Biology" }

Configure a hierarchical datasource

  1. Create the hierarchical datasource in Manage > Data Connections
  2. Add a schema.
  3. If the datasource is not online, you will need to add some default data.
  4. Check the data source is showing the hierarchical display fields you require. All the fields will be shown for all child data sets, not just the top level.
  5. In Design, add your Data Connection as a data question (top-level hierarchical questions will often be invisible and set to a Single Row selection as they are simply containers for the child data sets). In this example, the top level is just a container for the $person[] array.
  6. Add the child data references. Scroll down the list of Data Connections to find Data Question then choose the relevant child data set from the list of data objects. From this data question you will be able to access the display fields at this level eg: $person[].name, $person[].eMail, $person[].dateOfBirth
  7. Once you have a child set as a Data Question, you can then access the child data sets inside that by the same method. So you can set up a Data Question to access the $person[].assets[] to view the data in the fields $person[].assets[].description, $person[].assets[].type and $person[].assets[].value for the $person[] selected in the parent question.