Skip to content

Commit

Permalink
multiple cars, same name, add vin next to name (#4230)
Browse files Browse the repository at this point in the history
  • Loading branch information
swiffer authored Sep 29, 2024
1 parent 84335eb commit 1c2fa78
Show file tree
Hide file tree
Showing 21 changed files with 57 additions and 48 deletions.
4 changes: 2 additions & 2 deletions grafana/dashboards/battery-health.json
Original file line number Diff line number Diff line change
Expand Up @@ -1844,14 +1844,14 @@
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC",
"definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC",
"hide": 0,
"includeAll": false,
"label": "Car",
"multi": false,
"name": "car_id",
"options": [],
"query": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC",
"query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down
4 changes: 2 additions & 2 deletions grafana/dashboards/charge-level.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,14 @@
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"hide": 2,
"includeAll": true,
"label": "Car",
"multi": false,
"name": "car_id",
"options": [],
"query": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down
4 changes: 2 additions & 2 deletions grafana/dashboards/charges.json
Original file line number Diff line number Diff line change
Expand Up @@ -1579,14 +1579,14 @@
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"hide": 0,
"includeAll": false,
"label": "Car",
"multi": false,
"name": "car_id",
"options": [],
"query": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down
6 changes: 3 additions & 3 deletions grafana/dashboards/charging-stats.json
Original file line number Diff line number Diff line change
Expand Up @@ -2447,14 +2447,14 @@
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"hide": 2,
"includeAll": true,
"label": "Car",
"multi": false,
"name": "car_id",
"options": [],
"query": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down Expand Up @@ -2546,4 +2546,4 @@
"uid": "-pkIkhmRz",
"version": 8,
"weekStart": ""
}
}
4 changes: 2 additions & 2 deletions grafana/dashboards/drive-stats.json
Original file line number Diff line number Diff line change
Expand Up @@ -1057,14 +1057,14 @@
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"hide": 0,
"includeAll": false,
"label": "Car",
"multi": false,
"name": "car_id",
"options": [],
"query": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down
4 changes: 2 additions & 2 deletions grafana/dashboards/drives.json
Original file line number Diff line number Diff line change
Expand Up @@ -1543,14 +1543,14 @@
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"hide": 0,
"includeAll": false,
"label": "Car",
"multi": false,
"name": "car_id",
"options": [],
"query": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down
6 changes: 3 additions & 3 deletions grafana/dashboards/efficiency.json
Original file line number Diff line number Diff line change
Expand Up @@ -1100,14 +1100,14 @@
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"hide": 2,
"includeAll": true,
"label": "Car",
"multi": false,
"name": "car_id",
"options": [],
"query": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down Expand Up @@ -1289,4 +1289,4 @@
"uid": "fu4SiQgWz",
"version": 2,
"weekStart": ""
}
}
4 changes: 2 additions & 2 deletions grafana/dashboards/internal/charge-details.json
Original file line number Diff line number Diff line change
Expand Up @@ -1955,14 +1955,14 @@
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"hide": 0,
"includeAll": false,
"label": "Car",
"multi": false,
"name": "car_id",
"options": [],
"query": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down
4 changes: 2 additions & 2 deletions grafana/dashboards/internal/drive-details.json
Original file line number Diff line number Diff line change
Expand Up @@ -2639,14 +2639,14 @@
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"hide": 0,
"includeAll": false,
"label": "Car",
"multi": false,
"name": "car_id",
"options": [],
"query": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down
4 changes: 2 additions & 2 deletions grafana/dashboards/locations.json
Original file line number Diff line number Diff line change
Expand Up @@ -1194,14 +1194,14 @@
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"hide": 1,
"includeAll": true,
"label": "Car",
"multi": true,
"name": "car_id",
"options": [],
"query": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down
4 changes: 2 additions & 2 deletions grafana/dashboards/mileage.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,14 @@
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"hide": 2,
"includeAll": true,
"label": "Car",
"multi": false,
"name": "car_id",
"options": [],
"query": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down
4 changes: 2 additions & 2 deletions grafana/dashboards/overview.json
Original file line number Diff line number Diff line change
Expand Up @@ -2025,14 +2025,14 @@
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"hide": 2,
"includeAll": true,
"label": "Car",
"multi": false,
"name": "car_id",
"options": [],
"query": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down
4 changes: 2 additions & 2 deletions grafana/dashboards/projected-range.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,14 +704,14 @@
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"hide": 2,
"includeAll": true,
"label": "Car",
"multi": false,
"name": "car_id",
"options": [],
"query": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down
21 changes: 15 additions & 6 deletions grafana/dashboards/reports/dutch-tax.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
]
},
"pluginVersion": "7.2.2",
"repeat": "car_id",
"repeat": "car_id",
"scopedVars": {
"car_id": {
"selected": false,
Expand Down Expand Up @@ -360,14 +360,14 @@
"value": "$__all"
},
"datasource": "TeslaMate",
"definition": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"hide": 2,
"includeAll": true,
"label": "Car",
"multi": false,
"name": "car_id",
"options": [],
"query": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down Expand Up @@ -500,11 +500,20 @@
"2h",
"1d"
],
"time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "",
"title": "Drives - Dutch tax",
"uid": "lBIoQIggk",
"version": 1
}

}
4 changes: 2 additions & 2 deletions grafana/dashboards/states.json
Original file line number Diff line number Diff line change
Expand Up @@ -518,14 +518,14 @@
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"hide": 2,
"includeAll": true,
"label": "Car",
"multi": false,
"name": "car_id",
"options": [],
"query": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down
4 changes: 2 additions & 2 deletions grafana/dashboards/statistics.json
Original file line number Diff line number Diff line change
Expand Up @@ -842,14 +842,14 @@
"type": "grafana-postgresql-datasource",
"uid": "TeslaMate"
},
"definition": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"definition": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"hide": 2,
"includeAll": true,
"label": "Car",
"multi": false,
"name": "car_id",
"options": [],
"query": "SELECT COALESCE(name, CONCAT('VIN ', vin)) AS __text, id AS __value FROM cars ORDER BY display_priority ASC, name ASC;",
"query": "SELECT\n id as __value,\n CASE WHEN COUNT(id) OVER (PARTITION BY name) > 1 AND name IS NOT NULL THEN CONCAT(name, ' - ', RIGHT(vin, 6)) ELSE COALESCE(name, RIGHT(vin, 6)) end as __text \nFROM cars\nORDER BY display_priority ASC, name ASC, vin ASC;",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand Down
Loading

0 comments on commit 1c2fa78

Please sign in to comment.