Grafana

 avatar
unknown
plain_text
2 years ago
42 kB
4
Indexable
{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 1,
  "id": 3,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "testdata",
        "uid": "b64c0167-3f32-4c80-9526-e33a13b05fef"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "center",
            "cellOptions": {
              "type": "auto"
            },
            "inspect": false,
            "minWidth": 50,
            "width": 80
          },
          "links": [],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "ActualQty"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "ItemNo"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 68
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "FromTime"
            },
            "properties": [
              {
                "id": "custom.width"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Dari"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 61
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 13,
        "w": 3,
        "x": 0,
        "y": 0
      },
      "id": 3,
      "links": [
        {
          "targetBlank": true,
          "title": "Show",
          "url": "http://localhost:1880/ui"
        }
      ],
      "options": {
        "cellHeight": "sm",
        "footer": {
          "countRows": false,
          "fields": [],
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "10.0.1",
      "targets": [
        {
          "csvContent": "Dari,ItemNo,Target,ActualQty\n08:00,102391,85,84\n09:00,102391,85,84\n10:00,102391,90,89\n12:00,102391,85,83\n13:00,102391,80,85\n14:00,102391,78,50\n15:00,102391,75,74",
          "datasource": {
            "type": "testdata",
            "uid": "b64c0167-3f32-4c80-9526-e33a13b05fef"
          },
          "refId": "A",
          "scenarioId": "csv_content"
        }
      ],
      "transformations": [
        {
          "id": "configFromData",
          "options": {
            "applyTo": {
              "id": "byName",
              "options": "ActualQty"
            },
            "configRefId": "A",
            "mappings": [
              {
                "fieldName": "Target",
                "handlerKey": "threshold1",
                "reducerId": "lastNotNull"
              }
            ]
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "center",
            "cellOptions": {
              "mode": "lcd",
              "type": "gauge",
              "valueDisplayMode": "text"
            },
            "filterable": false,
            "inspect": false,
            "minWidth": 50
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "FromTime"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "ItemNo"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Dari"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Target"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 13,
        "w": 2,
        "x": 3,
        "y": 0
      },
      "id": 5,
      "options": {
        "cellHeight": "sm",
        "footer": {
          "countRows": false,
          "fields": [],
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "ActualQty"
          }
        ]
      },
      "pluginVersion": "10.0.1",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 3,
          "refId": "A"
        }
      ],
      "transformations": [
        {
          "id": "configFromData",
          "options": {
            "applyTo": {
              "id": "byName",
              "options": "ActualQty"
            },
            "configRefId": "A",
            "mappings": [
              {
                "fieldName": "Target",
                "handlerKey": "threshold1",
                "reducerId": "firstNotNull"
              }
            ]
          }
        }
      ],
      "type": "table"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 1,
        "w": 2,
        "x": 5,
        "y": 0
      },
      "id": 4,
      "options": {
        "displayMode": "gradient",
        "minVizHeight": 10,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true,
        "valueMode": "color"
      },
      "pluginVersion": "10.0.1",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 3,
          "refId": "A"
        }
      ],
      "transformations": [
        {
          "id": "configFromData",
          "options": {
            "applyTo": {
              "id": "byName",
              "options": "ActualQty"
            },
            "configRefId": "A",
            "mappings": [
              {
                "fieldName": "Target",
                "handlerKey": "threshold1",
                "reducerId": "firstNotNull"
              }
            ]
          }
        },
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "ActualQty",
                "Dari"
              ]
            }
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "equal",
                  "options": {
                    "value": "08:00"
                  }
                },
                "fieldName": "Dari"
              }
            ],
            "match": "any",
            "type": "include"
          }
        }
      ],
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisGridShow": false,
            "axisLabel": "",
            "axisPlacement": "hidden",
            "fillOpacity": 80,
            "gradientMode": "opacity",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineWidth": 1,
            "scaleDistribution": {
              "type": "linear"
            },
            "thresholdsStyle": {
              "mode": "dashed"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 100
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 12,
        "w": 2,
        "x": 7,
        "y": 0
      },
      "id": 12,
      "options": {
        "barRadius": 0,
        "barWidth": 0.97,
        "fullHighlight": false,
        "groupWidth": 0.7,
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": false
        },
        "orientation": "horizontal",
        "showValue": "auto",
        "stacking": "none",
        "tooltip": {
          "mode": "none",
          "sort": "none"
        },
        "xTickLabelRotation": 0,
        "xTickLabelSpacing": 0
      },
      "pluginVersion": "10.0.1",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 3,
          "refId": "A"
        }
      ],
      "transformations": [
        {
          "id": "configFromData",
          "options": {
            "applyTo": {
              "id": "byName",
              "options": "ActualQty"
            },
            "configRefId": "A",
            "mappings": [
              {
                "fieldName": "Target",
                "handlerKey": "threshold1",
                "reducerId": "lastNotNull"
              }
            ]
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "equal",
                  "options": {
                    "value": "08:00"
                  }
                },
                "fieldName": "Dari"
              }
            ],
            "match": "any",
            "type": "include"
          }
        },
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "Dari",
                "ActualQty"
              ]
            }
          }
        }
      ],
      "type": "barchart"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 1,
        "w": 2,
        "x": 9,
        "y": 0
      },
      "id": 11,
      "options": {
        "displayMode": "gradient",
        "minVizHeight": 10,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true,
        "valueMode": "color"
      },
      "pluginVersion": "10.0.1",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 3,
          "refId": "A"
        }
      ],
      "transformations": [
        {
          "id": "configFromData",
          "options": {
            "applyTo": {
              "id": "byName",
              "options": "ActualQty"
            },
            "configRefId": "A",
            "mappings": [
              {
                "fieldName": "Target",
                "handlerKey": "threshold1",
                "reducerId": "firstNotNull"
              }
            ]
          }
        },
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "ActualQty",
                "Dari"
              ]
            }
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "equal",
                  "options": {
                    "value": "08:00"
                  }
                },
                "fieldName": "Dari"
              }
            ],
            "match": "any",
            "type": "include"
          }
        }
      ],
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisGridShow": false,
            "axisLabel": "",
            "axisPlacement": "hidden",
            "fillOpacity": 80,
            "gradientMode": "opacity",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineWidth": 1,
            "scaleDistribution": {
              "type": "linear"
            },
            "thresholdsStyle": {
              "mode": "dashed"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 100
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 1,
        "w": 2,
        "x": 5,
        "y": 1
      },
      "id": 7,
      "options": {
        "barRadius": 0,
        "barWidth": 0.97,
        "fullHighlight": false,
        "groupWidth": 0.7,
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": false
        },
        "orientation": "horizontal",
        "showValue": "always",
        "stacking": "none",
        "tooltip": {
          "mode": "none",
          "sort": "none"
        },
        "xField": "Dari",
        "xTickLabelRotation": 0,
        "xTickLabelSpacing": 0
      },
      "pluginVersion": "10.0.1",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 3,
          "refId": "A"
        }
      ],
      "title": "tes",
      "transformations": [
        {
          "id": "configFromData",
          "options": {
            "applyTo": {
              "id": "byName",
              "options": "ActualQty"
            },
            "configRefId": "A",
            "mappings": [
              {
                "fieldName": "Target",
                "handlerKey": "threshold1",
                "reducerId": "lastNotNull"
              }
            ]
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "equal",
                  "options": {
                    "value": "08:00"
                  }
                },
                "fieldName": "Dari"
              }
            ],
            "match": "any",
            "type": "include"
          }
        },
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "Dari",
                "ActualQty"
              ]
            }
          }
        }
      ],
      "transparent": true,
      "type": "barchart"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 1,
        "w": 2,
        "x": 9,
        "y": 1
      },
      "id": 9,
      "options": {
        "displayMode": "gradient",
        "minVizHeight": 10,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true,
        "valueMode": "color"
      },
      "pluginVersion": "10.0.1",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 3,
          "refId": "A"
        }
      ],
      "transformations": [
        {
          "id": "configFromData",
          "options": {
            "applyTo": {
              "id": "byName",
              "options": "ActualQty"
            },
            "configRefId": "A",
            "mappings": [
              {
                "fieldName": "Target",
                "handlerKey": "threshold1",
                "reducerId": "firstNotNull"
              }
            ]
          }
        },
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "ActualQty",
                "Dari"
              ]
            }
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "equal",
                  "options": {
                    "value": "08:00"
                  }
                },
                "fieldName": "Dari"
              }
            ],
            "match": "any",
            "type": "include"
          }
        }
      ],
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 1,
        "w": 2,
        "x": 9,
        "y": 2
      },
      "id": 8,
      "options": {
        "displayMode": "gradient",
        "minVizHeight": 10,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true,
        "valueMode": "color"
      },
      "pluginVersion": "10.0.1",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 3,
          "refId": "A"
        }
      ],
      "transformations": [
        {
          "id": "configFromData",
          "options": {
            "applyTo": {
              "id": "byName",
              "options": "ActualQty"
            },
            "configRefId": "A",
            "mappings": [
              {
                "fieldName": "Target",
                "handlerKey": "threshold1",
                "reducerId": "firstNotNull"
              }
            ]
          }
        },
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "ActualQty",
                "Dari"
              ]
            }
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "equal",
                  "options": {
                    "value": "09:00"
                  }
                },
                "fieldName": "Dari"
              }
            ],
            "match": "any",
            "type": "include"
          }
        }
      ],
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 1,
        "w": 2,
        "x": 9,
        "y": 3
      },
      "id": 6,
      "options": {
        "displayMode": "gradient",
        "minVizHeight": 10,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true,
        "valueMode": "color"
      },
      "pluginVersion": "10.0.1",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 3,
          "refId": "A"
        }
      ],
      "transformations": [
        {
          "id": "configFromData",
          "options": {
            "applyTo": {
              "id": "byName",
              "options": "ActualQty"
            },
            "configRefId": "A",
            "mappings": [
              {
                "fieldName": "Target",
                "handlerKey": "threshold1",
                "reducerId": "firstNotNull"
              }
            ]
          }
        },
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "ActualQty",
                "Dari"
              ]
            }
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "equal",
                  "options": {
                    "value": "08:00"
                  }
                },
                "fieldName": "Dari"
              }
            ],
            "match": "any",
            "type": "include"
          }
        }
      ],
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "datasource",
        "uid": "-- Dashboard --"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 1,
        "w": 2,
        "x": 9,
        "y": 4
      },
      "id": 10,
      "options": {
        "displayMode": "gradient",
        "minVizHeight": 10,
        "minVizWidth": 0,
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true,
        "valueMode": "color"
      },
      "pluginVersion": "10.0.1",
      "targets": [
        {
          "datasource": {
            "type": "datasource",
            "uid": "-- Dashboard --"
          },
          "panelId": 3,
          "refId": "A"
        }
      ],
      "transformations": [
        {
          "id": "configFromData",
          "options": {
            "applyTo": {
              "id": "byName",
              "options": "ActualQty"
            },
            "configRefId": "A",
            "mappings": [
              {
                "fieldName": "Target",
                "handlerKey": "threshold1",
                "reducerId": "firstNotNull"
              }
            ]
          }
        },
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "Dari",
                "ActualQty"
              ]
            }
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "equal",
                  "options": {
                    "value": "08:00"
                  }
                },
                "fieldName": "Dari"
              }
            ],
            "match": "any",
            "type": "include"
          }
        }
      ],
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "mssql",
        "uid": "ec68ec2d-5d27-40ef-95ec-f865669fb644"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "green",
            "mode": "thresholds"
          },
          "custom": {
            "align": "center",
            "cellOptions": {
              "type": "color-text"
            },
            "inspect": false
          },
          "mappings": [
            {
              "options": {
                "BLUE": {
                  "color": "blue",
                  "index": 4,
                  "text": "BLUE"
                },
                "GREEN": {
                  "color": "green",
                  "index": 1,
                  "text": "GREEN"
                },
                "RED": {
                  "color": "red",
                  "index": 0,
                  "text": "RED"
                },
                "WHITE": {
                  "color": "#ffffff",
                  "index": 2,
                  "text": "WHITE"
                },
                "YELLOW": {
                  "color": "yellow",
                  "index": 3,
                  "text": "YELLOW"
                }
              },
              "type": "value"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "text",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "StatusLight"
            },
            "properties": [
              {
                "id": "custom.cellOptions",
                "value": {
                  "mode": "gradient",
                  "type": "color-background"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "MchNumber"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "SortOrder"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "MchDate"
            },
            "properties": [
              {
                "id": "custom.hidden",
                "value": true
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 29,
        "w": 12,
        "x": 0,
        "y": 13
      },
      "id": 1,
      "options": {
        "cellHeight": "md",
        "footer": {
          "countRows": false,
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true
      },
      "pluginVersion": "10.0.1",
      "targets": [
        {
          "datasource": {
            "type": "mssql",
            "uid": "ec68ec2d-5d27-40ef-95ec-f865669fb644"
          },
          "editorMode": "code",
          "format": "table",
          "rawQuery": true,
          "rawSql": "WITH Base AS (\n    SELECT\n        statusdate AS StatusTime, cast(StatusDate as date) as MchDate,\n        MchID,\n        StatusLight\n    FROM MchSTATUSTRX\n    WHERE\n        MchID = '$MchID'\n        AND YEAR(StatusDate) = '$Year'\n        AND MONTH(StatusDate) = '$Month'\n        AND DAY(statusdate) = '$Day'\n),\nQuery1 AS (\n    SELECT\n        A.SortOrder, B.MchID,\n        B.StatusLight,\n        MAX(B.StatusTime) AS StTime, MchDate\n    FROM MatrixMST A\n    LEFT JOIN Base B ON CAST(B.StatusTime AS TIME) >= A.FromTime AND CAST(B.StatusTime AS TIME) <= A.UntilTime\n    GROUP BY A.SortOrder,B.MchID, B.StatusLight, b.MchDate\n),\nQuery2 AS (\n    SELECT\n        A.SortOrder,\n        A.MchID,\n        A.StatusLight,\n        A.StTime,\n        A.MchDate,\n        B.FromTime,\n        B.UntilTime\n    FROM Query1 A\n    LEFT JOIN MatrixMST B ON A.SortOrder = B.SortOrder\n),\nFinal AS (\n    SELECT\n        SortOrder,\n        COALESCE(MchId, (\n            SELECT TOP 1 T2.MchId\n            FROM Query2 T2\n            WHERE T2.SortOrder < T.SortOrder\n              AND T2.MchId IS NOT NULL\n            ORDER BY T2.SortOrder DESC\n        )) AS MchId,\n        COALESCE(MchDate, (\n            SELECT TOP 1 T2.MchDate\n            FROM Query2 T2\n            WHERE T2.SortOrder < T.SortOrder\n              AND T2.MchDate IS NOT NULL\n            ORDER BY T2.SortOrder DESC\n        )) AS MchDate,\n        FromTime,\n        UntilTime,\n        COALESCE(StatusLight, (\n            SELECT TOP 1 T2.StatusLight\n            FROM Query2 T2\n            WHERE T2.SortOrder < T.SortOrder\n              AND T2.StatusLight IS NOT NULL\n            ORDER BY T2.SortOrder DESC\n        )) AS StatusLight\n    FROM Query2 T\n)\nSELECT Z.MchNumber,A.SortOrder,A.MchDate, convert(varchar, A.FromTime, 108) as FromTime, convert(varchar, A.UntilTime, 108) as UntilTime, Max(A.StatusLight) as StatusLight\nFROM Final A\njoin MachineMST Z on Z.MchID = A.MchID \nwhere MchNumber = '$MchNumber'\nGroup by Z.MchNumber,A.MchID,A.SortOrder, A.FromTime, A.UntilTime, a.MchDate",
          "refId": "A",
          "sql": {
            "columns": [
              {
                "parameters": [],
                "type": "function"
              }
            ],
            "groupBy": [
              {
                "property": {
                  "type": "string"
                },
                "type": "groupBy"
              }
            ],
            "limit": 50
          }
        }
      ],
      "title": "Log Sheet",
      "type": "table"
    }
  ],
  "refresh": "",
  "schemaVersion": 38,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "01",
          "value": "01"
        },
        "datasource": {
          "type": "mssql",
          "uid": "ec68ec2d-5d27-40ef-95ec-f865669fb644"
        },
        "definition": "select distinct(MchNumber) from MachineMST\nwhere MchNumber != ''",
        "hide": 2,
        "includeAll": false,
        "label": "MchNumber",
        "multi": false,
        "name": "MchNumber",
        "options": [],
        "query": "select distinct(MchNumber) from MachineMST\nwhere MchNumber != ''",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "current": {
          "selected": false,
          "text": "BR260001",
          "value": "BR260001"
        },
        "datasource": {
          "type": "mssql",
          "uid": "ec68ec2d-5d27-40ef-95ec-f865669fb644"
        },
        "definition": "select distinct(mchID) from MachineMST\nwhere MchNumber = '$MchNumber'",
        "hide": 2,
        "includeAll": false,
        "label": "MchID",
        "multi": false,
        "name": "MchID",
        "options": [],
        "query": "select distinct(mchID) from MachineMST\nwhere MchNumber = '$MchNumber'",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      },
      {
        "current": {
          "selected": true,
          "text": "26",
          "value": "26"
        },
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "Day",
        "options": [
          {
            "selected": false,
            "text": "01",
            "value": "01"
          },
          {
            "selected": false,
            "text": "02",
            "value": "02"
          },
          {
            "selected": false,
            "text": "03",
            "value": "03"
          },
          {
            "selected": false,
            "text": "04",
            "value": "04"
          },
          {
            "selected": false,
            "text": "05",
            "value": "05"
          },
          {
            "selected": false,
            "text": "06",
            "value": "06"
          },
          {
            "selected": false,
            "text": "07",
            "value": "07"
          },
          {
            "selected": false,
            "text": "08",
            "value": "08"
          },
          {
            "selected": false,
            "text": "09",
            "value": "09"
          },
          {
            "selected": false,
            "text": "10",
            "value": "10"
          },
          {
            "selected": false,
            "text": "11",
            "value": "11"
          },
          {
            "selected": false,
            "text": "12",
            "value": "12"
          },
          {
            "selected": false,
            "text": "13",
            "value": "13"
          },
          {
            "selected": false,
            "text": "14",
            "value": "14"
          },
          {
            "selected": false,
            "text": "15",
            "value": "15"
          },
          {
            "selected": false,
            "text": "16",
            "value": "16"
          },
          {
            "selected": false,
            "text": "17",
            "value": "17"
          },
          {
            "selected": false,
            "text": "18",
            "value": "18"
          },
          {
            "selected": false,
            "text": "19",
            "value": "19"
          },
          {
            "selected": false,
            "text": "20",
            "value": "20"
          },
          {
            "selected": false,
            "text": "21",
            "value": "21"
          },
          {
            "selected": false,
            "text": "22",
            "value": "22"
          },
          {
            "selected": false,
            "text": "23",
            "value": "23"
          },
          {
            "selected": false,
            "text": "24",
            "value": "24"
          },
          {
            "selected": false,
            "text": "25",
            "value": "25"
          },
          {
            "selected": true,
            "text": "26",
            "value": "26"
          },
          {
            "selected": false,
            "text": "27",
            "value": "27"
          },
          {
            "selected": false,
            "text": "28",
            "value": "28"
          },
          {
            "selected": false,
            "text": "29",
            "value": "29"
          },
          {
            "selected": false,
            "text": "30",
            "value": "30"
          },
          {
            "selected": false,
            "text": "31",
            "value": "31"
          }
        ],
        "query": "01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "current": {
          "selected": true,
          "text": "06",
          "value": "06"
        },
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "Month",
        "options": [
          {
            "selected": false,
            "text": "01",
            "value": "01"
          },
          {
            "selected": false,
            "text": "02",
            "value": "02"
          },
          {
            "selected": false,
            "text": "03",
            "value": "03"
          },
          {
            "selected": false,
            "text": "04",
            "value": "04"
          },
          {
            "selected": false,
            "text": "05",
            "value": "05"
          },
          {
            "selected": true,
            "text": "06",
            "value": "06"
          },
          {
            "selected": false,
            "text": "07",
            "value": "07"
          },
          {
            "selected": false,
            "text": "08",
            "value": "08"
          },
          {
            "selected": false,
            "text": "09",
            "value": "09"
          },
          {
            "selected": false,
            "text": "10",
            "value": "10"
          },
          {
            "selected": false,
            "text": "11",
            "value": "11"
          },
          {
            "selected": false,
            "text": "12",
            "value": "12"
          }
        ],
        "query": "01,02,03,04,05,06,07,08,09,10,11,12",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      },
      {
        "current": {
          "selected": false,
          "text": "2023",
          "value": "2023"
        },
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "Year",
        "options": [
          {
            "selected": true,
            "text": "2023",
            "value": "2023"
          },
          {
            "selected": false,
            "text": "2022",
            "value": "2022"
          },
          {
            "selected": false,
            "text": "2024",
            "value": "2024"
          }
        ],
        "query": "2023,2022,2024",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "utc",
  "title": "Daily LogSheet",
  "uid": "x123a",
  "version": 6,
  "weekStart": ""
}
Editor is loading...