Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
{
    "name": "customers_metric",
    "type": "metric",
    "content": {
        "type": "function_count",
        "content": [
            {
                "type": "property",
                "value": "customers.customer_id"
            }
        ]
    }
}

This metric applies the function_count function to the customer_id property of our customers table. Simple as that.

We will save this metric as customers_metric.json to the /metadata/metrics directory and add it to the project using addMetadata.

Indicator

Indicator is linked to a specific Metric, and describes how it's results will be visualized in the map.

...

Save this indicator as customers_indicator.json to the /metadata/indicators directory and add it using addMetadata command.

Each indicator must have its corresponding indicator drill object. Indicator drills are covered in one of the following tutorials. But for now, we'll just add an empty_indicator_drill with empty content key to the project.

...

Save this indicator drill as empty_indicator_drill.json to the /metadata/indicatorDrills directory and add it using addMetadata command.

The final step is to modify the dashboard we've added in one of the previous chapters. We will put there the indicator we've just added. Please note you need to manually edit existing JSON file.

Info

Please note that the id, accessInfo and links objects will be different, as they are generated and read only.

...

The content of a dashboard consists of blockRows array, which represents one row of indicators on the dashboard. There's a link to customers_indicator.json and to emtpy_indicator_drill.json. The layout of the indicator is primary. You will learn more about dashboards in one of the following tutorials.

Then use pushProject to push the changes to the previously added object.

...