Help with SQL query for custom dashboard
We are trying to create a dashboard that shows us unassigned workitems for a specified group, and then a count for those. Also the same dashboard should show all open workitems for a specified group.
I found this one to get me started, https://community.cireson.com/discussion/3708/how-to-create-custom-views-on-analyst-portal-contain-both-incident-and-service-requests
The problem is if i use the suggestion in the link above all i see is incidents, i need to see everything: SR#, PR#, CR# and so on.
If i remove the "AND SdS.LocaleID = 'SVE'" from the suggestion above i get everything, the problem is that i can see the same workitem 2-4 times.
The next thing is that i only want to see open workitems, nothing that is closed or solved.
this is my query
-----
So as i said, this will give me all active IR#, but nothing else.
If i remove the "AND ***.LocaleID = 'SVE'" i get everything, but doublets.
I tried to use a search for my dashboard, but there doesn't seem to be any way to filter on support group.
Best Answer
-
Service_Desk2 Member IT Monkey ✭We ended up with this query:SELECT DISTINCTa.WorkItemId AS 'ID',a.Title AS 'TITEL',(SELECT MAX(DisplayString)FROM [CiresonPortal].[dbo].[DisplayString] as bWHERE b.ElementID = a.StatusId) AS 'STATUS',a.AssignedUser AS 'TILLDELAD',(CASEWHEN LEN(a.PriorityId) < 2THENa.PriorityIdELSE(SELECT MAX(DisplayString)FROM [CiresonPortal].[dbo].[DisplayString] as eWHERE e.ElementID = a.PriorityId)END) AS 'PRIORITET',a.AffectedUser AS 'BERÖRD ANVÄNDARE',(SELECT MAX(DisplayString)FROM [CiresonPortal].[dbo].[DisplayString] as cWHERE c.ElementID = a.TierId) AS 'KATEGORI',(SELECT MAX(DisplayString)FROM [CiresonPortal].[dbo].[DisplayString] as dWHERE d.ElementID = a.CategoryId) AS 'SUPPORTGRUPP',a.Created AS 'SKAPAD DATUM'FROM[CiresonPortal].[dbo].[WorkItem] AS aWHERE (SELECT MAX(DisplayString)FROM [CiresonPortal].[dbo].[DisplayString] as fWHERE f.ElementID = a.StatusId) NOT IN ('Stängd', 'Closed', 'Avbruten', 'Cancelled', 'Löst', 'Resolved', 'Slutförd', 'Completed', 'Misslyckades', 'Failed') -- status ni inte vill seAND(SELECT MAX(DisplayString)FROM [CiresonPortal].[dbo].[DisplayString] as cWHERE c.ElementID = a.TierId) = 'Helpdesk' -- gruppORDER BY 'ID','TITEL','STATUS','TILLDELAD','PRIORITET','BERÖRD ANVÄNDARE','KATEGORI','SUPPORTGRUPP', 'SKAPAD DATUM'1
Answers