Skip to content

Grid

Description

Configurable grid display showing one row per user. See detailed grid documentation

Attributes

  • tile=grid
  • title
  • grid
    • dispatches: dispatch query
    • users: user query to define the rows
    • fields: [Array of objects]
      • title
      • render: attributes | metrics | images | dispatch
      • width: column width
      • Also include an additional attributes based on render option which describe below with each options

Simple Example

{
    "tile":"grid",
    "grid": {
        "dispatches": <dispatch query>,
        "users": <user query>,
        "fields": [
            {
                "render": <panel below>,
                "title": <title>,
                "width": <width in pts>
            }
        ]
    }
}    

Render Options

Display the data based on user attributes and dispatches values attributes. When using a user attribute use a $user in front of attribute name like $user.mobile it return the mobile number of user.

  • render=attributes
  • width: Container Width in number
  • sort: asc | desc; for widgets that show mulitple entries
  • take: how many entries to take from the list
  • match
  • createTracker: used for adding new entries
  • contentWidth
  • variant
  • show
  • trackers
  • attributes: [Array]
    • source: path to value
    • title: optional title to display
    • formatAs: optional title to display

Attributes Example

{
  "grid": {
    "dispatches": "given tracker[wellness]",
    "users": "given group [Test]",
    "fields": [
      {
        "title": "Field Test 1",
        "render": "attributes",
        "width": 300,
        "attributes": [
          {
            "source": "wellness.sleep",
            "title": "Sleep"
          },
          {
            "source": "wellness.expression",
            "title": "Expression"
          },
          {
            "source": "$user.dob",
            "title": "User Attributes Test"
          }
        ]
      }
    ]
  }
}

Display a string list which matched with the dispatches values

  • render=metrics
  • width: container Width in number
  • trackers: [Array of tracker handles]
  • show: [Objects]
    • [metric key Which matched with dispatches values]: [Array]
      • first element: Title
      • second element: Metric Kind. Array | String | boolean

Metric Example

"grid": {
    "dispatches": "given tracker[wellness]",
    "users": "given group [Test]",
    "fields": [
      {
        "title": "Field Test 1",
        "render": "metrics",
        "trackers": [
          "wellness"
        ],
        "show": {
          "sleep": [
            "Sleep Ration",
            "number"
          ],
          "expression": [
            "Expression Ratio",
            "number"
          ]
        }
      }
    ]
  }

Display images from the matched dispatch.

  • render=images
  • title
  • width
  • trackers: Array of tracker handles
  • takeRight: N, take from the end of the list N entries
  • styles: style override

Images Example

{
  "grid": {
    "dispatches": "given tracker[photos]",
    "users": "given group [Test]",
    "fields": [
      {
        "title": "Field Test 1",
        "render": "images",
        "width": 120,
        "contentWidth": 50,
        "trackers": [
          "photos"
        ]
      }
    ]
  }
}
  • render=dispatch
  • title: Provide a Dispatch title
  • width
  • trackers: [Array] Provide a list of tracker handles for the dispatch filtration
  • match: Provide a valid Date definition - see Date
  • period: Provide a valid Period definition - see Period
  • variant: dispatch | sheet. By default, is dispatch.
  • sheet: [Object] Provide if variant is sheet
    • count: number
    • start: period expression - see Period
    • period: period expression - see Period
    • align: week | isoWeek | month | year. By default, is isoWeek
    • metrics: [Array of Object]
      • property: Provide a valid Dispatch values attribute which matches with dispatch values.
      • title
      • kind: title | field.
      • adornment: Provide a label for the text Fields
      • adornmentPos: start | end. Start Input position of textField
    • tracker: Provide a tracker handle for dispatch filtration
    • match: Provide a valid time expression to match with dispatch data for e.g. YYYY-MM-DD
    • write: [Array of Numbers] Provide a text field index to write the data
    • clone: [Array of Numbers] Provide a text field index to clone the data
  • createTracker: Provide a tracker handle for data creation if have not matching dispatches.

Example1

{
  "grid": {
    "dispatches": "given tracker[wellness]",
    "users": "given group [Test]",
    "fields": [
      {
        "title": "Field Test 1",
        "render": "dispatch",
        "width": 120,
        "trackers": [
          "wellness"
        ],
        "variant: "dispatch",
        "match": "YYYY-MM-DD",
        "createTracker": "wellness"
      }
    ]
  }
}

Dispatch Sheet

Dispatch sheet allows a grid display with dates across the top and metrics down as rows. Dispatches can be created for each column.

Example2

{
   "grid": {
        "dispatches": "given tracker[wellness]",
        "users": "given group [Test]",
        "fields": [
          {
            "title": "Field Test 1",
            "render": "dispatch",
            "width": 120,
            "trackers": [
              "wellness"
            ],
            "variant": "sheet",
            "sheet": {
              "count": 5,
              "tracker": "wellness",
              "match": "YYYY-MM-DD",
              "align": "year",
              "clone": [1,3,5],
              "write": [2,4],
              "metrics": [
                {
                  "property": "sleep",
                  "title": "Property 1",
                  "kind": "title"
                },
                {
                  "property": "sleep",
                  "title": "Property 1",
                  "kind": "value",
                  "adornment": "Hello Test Label",
                  "adornmentPos": "start"
                }
              ]
            },
            "match": "YYYY-MM-DD",
            "createTracker": "wellness"
          }
        ]
      }
}

Combined Example

{
    "tile": "grid",
    "display": {
    "span": "12"
    },
    "grid": {
        "dispatches": "given group [players], given trackers[wellness] from today to -6 weeks",
        "users": "given group [players]",
        "fields": [
            {
                "title": "Physical",
                "render": "attributes",
                "width": 120,
                "attributes": [            
                    {
                    "source": "intake.fitness"
                    },
                    {
                    "source": "$user.dob",
                    "title": "Age"
                    }
                ]
            },
            {
                "title": "Diet",
                "render": "metrics",
                "width": 120,
                "trackers": ["preprogramDiet"],
                "show": {
                    "dairyKinds": ["What kinds of dairy","array"],                
                    "preferences": ["Comments","string"]
                }
            },
            {
                "title": "3 Photos",
                "render": "images",
                "width": 120,
                "contentWidth": 40,
                "trackers": ["preprogramPhotos"]
            },            
            {
                "title": "Last week",
                "render": "dispatch",
                "width": 180,
                "trackers": ["wellness"],
                "match": "GGGG-WW",
                "period": "-1 week"
            },
            {
                "title": "This week",
                "render": "dispatch",
                "width": 180,
                "trackers": ["wellness"],
                "match": "GGGG-WW",
                "createTracker": "wellness",
                "variant": "sheet",
                "sheet": {
                    "metrics": [
                        {
                            "kind": "title",
                            "title": "Stuff"
                        },
                        {
                            "property": "score",
                            "adornment": "pts"
                        },
                        {
                            "property": "stress"
                        }
                    ],
                    "match": "GGGG-WW",
                    "period": "P1W",
                    "start": "-P5W",
                    "align": "isoWeek",
                    "count": 6,
                    "write": [4,5],
                    "clone": [4],
                    "tracker": "wellness"
                }
            }
        ]
    }
}