Map the results to a tabular format

The Output Module supports a tabular output format and uses a different kind of ViewConfig, called TableViewConfig. TableViewConfig has a Columns mapping section that assigns each selected field to a column. The previous examples use the ViewConfig as input to the API to produce a JSON tree format.

The following example uses TableViewConfig. This is available under the same {{domain}}/rest/2.0/outputModule/export/json endpoint, just using the TableViewConfig as the JSON payload.

{
  "TableViewConfig": {
    "displayLength": 5,
    "displayStart": 10,
    "Resources": {
      "Community": {
        "Id": { "name": "communityId" },
        "Name": { "name": "communityName" },
        "Description": { "name": "communityDescription" }
      }
    },
    "Columns": [
      { "Column": { "fieldName": "communityId" } },
      { "Column": { "fieldName": "communityName" } },
      { "Column": { "fieldName": "communityDescription" } }
    ]
  }
}
---
TableViewConfig:
  displayLength: 5
  displayStart: 10
  Resources:
    Community:
      Id:
        name: "communityId"
      Name:
        name: "communityName"
      Description:
        name: "communityDescription"
  Columns:
  -
    Column:
      fieldName: "communityId"
  -
    Column:
      fieldName: "communityName"
  -
    Column:
      fieldName: "communityDescription"

When formatted, this query produces an array of rows, each containing the requested columns.

{
    "iTotalDisplayRecords": 48,
    "iTotalRecords": 5,
    "aaData": [
        {
            "communityId": "12345678-0006-0000-0000-000000000000",
            "communityName": "Simple Community 6",
            "communityDescription": ""
        },
        {
            "communityId": "12345678-0007-0000-0000-000000000000",
            "communityName": "Simple Community 7",
            "communityDescription": ""
        },
        {
            "communityId": "12345678-0008-0000-0000-000000000000",
            "communityName": "Simple Community 8",
            "communityDescription": ""
        },
        {
            "communityId": "12345678-0009-0000-0000-000000000000",
            "communityName": "Simple Community 9",
            "communityDescription": ""
        },
        {
            "communityId": "12345678-0010-0000-0000-000000000000",
            "communityName": "Simple Community 10",
            "communityDescription": ""
        }
    ]
}

Because the Columns mapping determines what should be returned, setting hidden: true on a property has no effect in a TableViewConfig.

In the following example, the "displayLength" value is set to 0. This query shows the number of entities without retrieving actual results.

The JSON Data Table output contains the total number of available records in Collibra for this query, which is iTotalDisplayRecords. It also contains the number of records returned in this set, which is iTotalRecords.

{
    "iTotalDisplayRecords": 48,
    "iTotalRecords": 0,
    "aaData": []
}

You can use the TableViewConfig queries with the following endpoints:

  • {{domain}}/rest/2.0/outputModule/export/{{json | csv}}
  • {{domain}}/rest/2.0/outputModule/export/{{json | csv | excel}}-file
  • {{domain}}/rest/2.0/outputModule/export/{{json | csv | excel}}-job