Full Report Example

This is an example report that contains all widget and filter types. Feel free to copy this and paste it in your report editor to experiment with the different types of visualizations and filters.

report:
  title: Report with all widgets
  shortDescription: This reports tests all widgets
  longDescription: |
    ## What does this report show?
    All widgets and their possible visualizations
  logo: aws
  tags:
    - tag1
    - tag2
  filters:
    - type: generic
      filterLabel: Option
      filterExpression: account_id_filtered = '?'
      options:
        - label: account 1
          value: 1
        - label: account 2
          value: 2
        - label: account 3
          value: 3

    - type: generic
      filterLabel: Account
      filterExpression: account_id = '?'
      query: | 
        select value, label from (
            select 1 as value, 'account 1' as label union all
            select 2 as value, 'account 2' as label union all
            select 3 as value, 'account 3' as label
        ) order by value

    - type: date
      filterLabel: Event Date
      filterExpression: event_time < '?'
      defaultValue: now() - interval 30 DAY

    - type: date
      filterLabel: Expiration
      filterExpression: expiration_date < '?'
      defaultValue: now() + interval 30 DAY
      mode: future

    - type: search
      filterExpression: ip_address LIKE '%?%'
      filterLabel: IP Address

    - type: search
      filterExpression: average_load >= '?'
      filterLabel: minimum average load (%)
      defaultValue: 50

  groups:
    - title: Group with filtered widgets
      description: Widgets using the filters above
      widgets:
        - title: Widget with a generic option filter
          display:
            type: table
          query: |
            select account_id as account_id_filtered, account_name from (
                select 1 as account_id, 'account 1' as account_name union all
                select 2 as account_id, 'account 2' as account_name
            )
            where 1=1 and account_id_filtered = '?'
        - title: Widget with a generic filter
          display:
            type: table
          query: |
            select account_id, account_name from (
                select 1 as account_id, 'account 1' as account_name union all
                select 2 as account_id, 'account 2' as account_name
            )
            where 1=1 and account_id = '?'

        - title: widget filtered by Event Date
          display:
            type: table
          query: |
            select event_time from (
                select now() as event_time union all
                select now() - interval 10 day as event_time 
            )
            where 1=1 and event_time < '?'

        - title: widget filtered by Expiration Date
          display:
            type: table
          query: |
            select expiration_date from (
                select now() as expiration_date union all
                select now() + interval 10 day as expiration_date 
            )
            where 1=1 and expiration_date < '?'
        
        - title: widget using search without default value
          display:
            type: table
          query: |
            select ip_address from (
                select '192.168.1.1' as ip_address union all
                select '192.168.1.2' as ip_address union all
                select '192.168.2.1' as ip_address union all
                select '192.168.3.1' as ip_address 
            )
            where 1=1 and ip_address LIKE '%?%'
        
        - title: widget using search with default value
          display:
            type: table
          query: |
            select ip_address, average_load from (
                select '192.168.1.1' as ip_address, 30 as average_load union all
                select '192.168.1.2' as ip_address, 40 as average_load union all
                select '192.168.2.1' as ip_address, 50 as average_load union all
                select '192.168.3.1' as ip_address, 60 as average_load 
            )
            where 1=1 and average_load >= '?'
  
    - title: Unfiltered widgets
      description: simple widgets with no filters applied
      widgets:
      - title: label widget
        display:
          type: label
        query: |
          select 1
      - title: bar chart widget
        display:
          type: bar_chart
          entryLabel: average
        query: |
          select 'row 1' as x, 2 as y union all
          select 'row 2' as x, 3 as y
      - title: pie chart widget
        display:
          type: pie_chart
          total:
            show: true
            label: pie chart label
        query: |
          select 'slice 1' as slice, 10 as value union all
          select 'slice 2' as slice, 20 as value union all
          select 'slice 3' as slice, 5 as value
      - title: table widget
        display:
          type: table
        query: |
          select 'EU' as region, 2 as count, toDate(now()) as date union all
          select 'US' as region, 3 as count, toDate(now()) as date
      - title: table widget with search
        display:
          type: table
        query: |
          select 'EU' as region, 2 as count, toDate(now()) as date, concat('eu','abc') as search_string union all
          select 'US' as region, 3 as count, toDate(now()) as date, concat('us','def') as search_string
      - title: bar chart with multiple series
        display:
          type: bar_chart
        width: 100%
        query: |
          WITH
            toDate('2024-01-01') AS start_date,
            toDate('2024-01-05') AS end_date
          SELECT
            date,
            map(
            'series 1', randUniform(10, 50),
            'series 2', randUniform(0, 100),
            'series 3', randUniform(10, 30)
            ),
          FROM
            (
              SELECT addDays(start_date, number) AS date
              FROM numbers(dateDiff('day', start_date, end_date) + 1)
            )
          ORDER BY 
              date;
      - title: XY-chart
        display:
          type: xy_chart
          width: 100%
        queries:
          - title: Random series 1
            query: |
              WITH
                toDate('2024-01-01') AS start_date,
                toDate('2024-01-05') AS end_date
              SELECT
                date,
                rand() / 1000000000 as random_normal
              FROM
                (
                  SELECT addDays(start_date, number) AS date
                  FROM numbers(dateDiff('day', start_date, end_date) + 1)
                )
              ORDER BY 
                  date;
          - title: Random series 2
            query: |
              WITH
                toDate('2024-01-01') AS start_date,
                toDate('2024-01-05') AS end_date
              SELECT
                date,
                rand() / 1000000000 AS random_normal
              FROM
                (
                  SELECT addDays(start_date, number) AS date
                  FROM numbers(dateDiff('day', start_date, end_date) + 1)
                )
              ORDER BY 
                  date;

Last updated

Was this helpful?