Advanced: nested columns example

Overview

To give a brief overview of using vertical sections for columns, the following image shows extracting numbered headings and their columns with these steps:

  1. define a section group
  2. define a nested vertical section group

Click to enlargeClick to enlarge

The following config uses abbreviated YML notation to give an overview of the more complex SenseML JSON:

fields: []
sections:
- id: parentSections
  range:
    anchor:
      match:
        type: startsWith
        text: heading
  fields:
  - id: sectionTitle
    method:
      id: passthrough
    anchor:
      match:
        type: startsWith
        text: heading
  sections:
  - id: nestedColumns
    range:
      direction: vertical
      anchor:
        match:
          type: startsWith
          text: column
    fields:
    - id: columnTitle
      method:
        id: passthrough
      anchor:
        match:
          type: startsWith
          text: column

With this approach, you can output something like the following, using abbreviated YML notation to give an overview of the more complex JSON API response:

---
parentSections:
- sectionTitle:
    type: string
    value: Heading 1
  nestedColumns:
  - columnTitle:
      type: string
      value: Column A
  - columnTitle:
      type: string
      value: Column B
  - columnTitle:
      type: string
      value: Column C
- sectionTitle:
    type: string
    value: Heading 2
  nestedColumns:
  - columnTitle:
      type: string
      value: Column D
  - columnTitle:
      type: string
      value: Column E
  - columnTitle:
      type: string
      value: Column F

Details

The following elaborates on the preceding overview using JSON instead of YML.

Config

{
  "fields": [],
  "sections": [
    {
      "id": "parentSections",
      "range": {
        "anchor": {
          "match": {
            "type": "startsWith",
            "text": "heading"
          }
        }
      },
      "fields": [
        {
          "id": "sectionTitle",
          "method": {
            "id": "passthrough"
          },
          "anchor": {
            "match": {
              "type": "startsWith",
              "text": "heading"
            }
          }
        }
      ],
      "sections": [
        {
          "id": "nestedColumns",
          "range": {
            "direction": "vertical",
            "anchor": {
              "match": {
                "type": "startsWith",
                "text": "column"
              }
            }
          },
          "fields": [
            {
              "id": "columnTitle",
              "method": {
                "id": "passthrough"
              },
              "anchor": {
                "match": {
                  "type": "startsWith",
                  "text": "column"
                }
              }
            }
          ]
        }
      ]
    }
  ]
}

Example document
The following image shows the example PDF used with this example config:

Click to enlargeClick to enlarge

Example PDFDownload link

Output

{
  "parentSections": [
    {
      "sectionTitle": {
        "type": "string",
        "value": "Heading 1"
      },
      "nestedColumns": [
        {
          "columnTitle": {
            "type": "string",
            "value": "Column A"
          }
        },
        {
          "columnTitle": {
            "type": "string",
            "value": "Column B"
          }
        },
        {
          "columnTitle": {
            "type": "string",
            "value": "Column C"
          }
        }
      ]
    },
    {
      "sectionTitle": {
        "type": "string",
        "value": "Heading 2"
      },
      "nestedColumns": [
        {
          "columnTitle": {
            "type": "string",
            "value": "Column D"
          }
        },
        {
          "columnTitle": {
            "type": "string",
            "value": "Column E"
          }
        },
        {
          "columnTitle": {
            "type": "string",
            "value": "Column F"
          }
        }
      ]
    }
  ]
}

Did this page help you?