CA Service Management

Expand all | Collapse all

Two days ago ticket count assignee and category wise

caadmin_GJ

caadmin_GJAug 23, 2018 03:15 AM

  • 1.  Two days ago ticket count assignee and category wise

    Posted Aug 22, 2018 05:08 PM

    Hi Experts,

    I want to create a report in which, i want to take count of all ticket which are opened two days ago along with assignee_combo_name and category_symbol

    format should be like this

    Assignee_Name    Category_symbol  Count_of Ticket_opened_2_days_ago

     

    Please help.

    Regards,

    Ritu



  • 2.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 23, 2018 12:11 AM

    Hi Experts,

     

    as of now my below is working 

    Select assignee_last_name,category_symbol,
    sum(case when active = 1 and open_date >= PdmAddDays(-2) then 1 else 0 end) as T1
    from cr
    WHERE type = 'I'
    group by assignee_last_name,category_symbol

     

    but it is not working for assignee_combo_name field, getting below error

     

     

    Please help, TIA.



  • 3.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 23, 2018 03:15 AM

    Any quick help would be must appreciated. 



  • 4.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 23, 2018 03:49 AM

    Hi I belive that answer to you problem is described in this document

    "AHD12019:Cannot use sync_fetch for a query" error - CA Knowledge  



  • 5.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 23, 2018 03:52 AM

    you can try this query instead

     

    Select (cnt.last_name + ' ' + cnt.first_name) as combo_name1,category_symbol,
    sum(case when active = 1 and open_date >= PdmAddDays(-2) then 1 else 0 end) as T1
    from cr
    inner join cnt  on  cr.assignee_userid =cnt.userid
    WHERE cr.type = 'I'
    group by   (cnt.last_name + ' ' + cnt.first_name)  ,category_symbol



  • 6.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 23, 2018 06:52 AM

    Thanks @Aleksandar_Stancic , let me try suggested input and get back to you.



  • 7.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 23, 2018 12:14 PM

    @Aleksandar_Stancic in combo_name1 field, it is not  giving combo_name field value, please check below screenshot

    and giving error in query "no viable alternative at input '('" , what could be the issue, please help

     



  • 8.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 24, 2018 03:52 AM

    try this

    Select CONCAT(cnt.last_name,', ' , cnt.first_name) as combo_name,category_symbol,
    sum(case when active = 1 and open_date >= PdmAddDays(-2) then 1 else 0 end) as T1
    from cr
    inner join cnt  on  cr.assignee_userid =cnt.userid
    WHERE cr.type = 'I'
    group by  category_symbol, cnt.last_name,cnt.first_name



  • 9.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 24, 2018 04:16 PM

    Very Nice.  Yesterday  I found CONCAT via GOOGLE (Good friend of mine)  but query still falied and I couldn't determine why.  Come to find out it was the group by clause.  Never tried  

     

    group by  category_symbol, cnt.last_name,cnt.first_name. 

     

    Glad I read this post before going further.  



  • 10.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 25, 2018 12:33 AM

    it is not working, SteveTroy , is it working for you?,  can you give me your whole query.

    I want to get assignee_combo_name along with category_symbol and count of ticket



  • 11.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 25, 2018 12:56 PM

    This query works

     

    Select CONCAT(cnt.last_name,', ' , cnt.first_name) as combo_name, category_symbol,
    sum(case when active = 1 then 1 else 0 end) as T1
    from cr
    inner join cnt on cr.assignee_userid = cnt.userid
    WHERE cr.type = 'I'
    and cnt.last_name = cr.assignee_last_name
    group by category_symbol, cnt.last_name,cnt.first_name

     



  • 12.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 26, 2018 10:56 AM

    Thanks SteveTroy for sharing the query.

    Have you encountered any performance issue during running this query, i dont know exact reason but this query is taking very long time to even show 10 records.



  • 13.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 26, 2018 01:43 PM

    Its Working now after making changes in where clause 

    Select CONCAT(cnt.last_name,', ' , cnt.first_name) as combo_name, category_symbol,
    sum (case when cr.open_date > PdmAddDays (-3) and (cr.resolve_date != PdmAddDays (-2) and cr.resolve_date != PdmAddDays (-2)) then 1 else 0 end) as T1
    from cr
    inner join cnt on cr.assignee_userid = cnt.userid
    WHERE cr.open_date >PdmAddDays(-10) and cr.type = 'I'
    and cnt.last_name = cr.assignee_last_name
    group by cnt.last_name,cnt.first_name,category_symbol



  • 14.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 26, 2018 02:05 PM

    Thanks SteveTroy and @Aleksandar_Stancic  for help and support.

    Now coming back to original question, how i can show count of tickets which are active two days ago, any idea ?

    Is it possible that jaspersoft can store today's count of active ticket which are having open date > PdmAddDays (-3) and add yesterday resolve ticket of open date > PdmAddDays (-3) and again add resolve ticket count of two day ago ticket having open date > PdmAddDays (-3).

     

    Please help, how this can be done in jaspersoft.

     

    TIA



  • 15.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 27, 2018 03:44 AM

    Hi SteveTroy,

     

    Can below query help me to get the desired result, in which i want to get count of ticket which were open and active two days ago , not sure if it is logically correct ?

     

    Select CONCAT(cnt.last_name,', ' , cnt.first_name) as combo_name, category_symbol,
    sum (case when (cr.open_date > PdmAddDays (-3) and active = 1) and ((cr.resolve_date = PdmAddDays (-2) and cr.open_date > PdmAddDays (-3)) and (cr.resolve_date = PdmAddDays (-1) and cr.open_date > PdmAddDays (-3) ) ) then 1 else 0 end) as T1
    from cr
    inner join cnt on cr.assignee_userid = cnt.userid
    WHERE cr.open_date >PdmAddDays(-60) and cr.type = 'I'
    and cnt.userid = cr.assignee_userid
    group by cnt.last_name,cnt.first_name,category_symbol



  • 16.  Re: Two days ago ticket count assignee and category wise
    Best Answer

    Posted Aug 28, 2018 01:06 PM

    I am not sure if it is logically correct either.  I suggest breaking the SUM SQL query into multiple SUM SQL and confirming the counts individually.  



  • 17.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 28, 2018 02:06 PM

    Thanks SteveTroy



  • 18.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 29, 2018 03:10 AM

    SteveTroy , how i can eliminate/ignore/hide one row which is having all zero value in multiple SUM SQL query ?

    Currently when i am doing group by assignee and category it also producing combination for old record because i am not applying any condition in where clause, so any luck if i can hide those row from final output of multiple SUM SQL



  • 19.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 29, 2018 08:16 AM

    SteveTroy , i tried  T0 <> 0 or T1 <> 0 or T2 <> 0  in where clause but still not working , any clue would must appreciated here. :-) 



  • 20.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 29, 2018 11:30 AM

    In Jasper add a print when condition and suppress the row of the values are 0.  



  • 21.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 30, 2018 01:57 AM

    Thanks SteveTroy , it worked but giving blank page now.



  • 22.  Re: Two days ago ticket count assignee and category wise

    Posted Aug 30, 2018 04:17 AM

    if previous query is correct use this 

     

     

    select x.combo_name as combo_name,x.category_sym as category_symbol, x.T1 as T1 from
    (Select CONCAT(cnt.last_name,', ' , cnt.first_name) as combo_name, category_symbol as category_sym,
    sum (case when cr.open_date > PdmAddDays (-3) and (cr.resolve_date != PdmAddDays (-2) and cr.resolve_date != PdmAddDays (-2)) then 1 else 0 end) as T1
    from cr
    inner join cnt on cr.assignee_userid = cnt.userid
    WHERE cr.open_date >PdmAddDays(-10) and cr.type = 'I'
    and cnt.last_name = cr.assignee_last_name
    group by cnt.last_name,cnt.first_name,category_symbol) x
    where x.T1>0