on 2016 May 19 10:04 AM
Hi everybody,
my report period is e.g. for last month (April) in the SQL-Statement.
Is there a way the concerning period automatically could be inserted in the report title (in a text field or whatever), e.g. "Number of incidents assigned by Service Desk in ......".
I hope it´s understandable what I am asking for?
Thanks in advance.
Rgds
Eberhard
Hi Eberhard,
Assuming the report only returns data for one month, you can create a formula with this code:
'Number of incidents assigned by Service Desk in ' & Totext(Maximum({Date Field}), 'MMMM')
Drag and drop this formula field on the header.
-Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can only find the INCIDENT.DATE_LOGGED.
here is the query:
SELECT
INCIDENT_ID,
COUNT(ACT_TYPE_ID) - (SELECT COUNT(*) FROM act_reg a2 WHERE act_reg.incident_id = a2.incident_id AND act_type_id = 6) AS ZUWEISUNGEN
FROM
ACT_REG
WHERE
ACT_TYPE_ID = 1 AND
(ACT_REG.ASSYST_USR_ID != '473' or ACT_REG.ASSYST_USR_ID != '712' or ACT_REG.ASSYST_USR_ID != '323' or ACT_REG.ASSYST_USR_ID != '780') AND
ACT_REG.SERV_DEPT_ID = 28 AND
ACT_REG.ASS_SVD_ID <> 28 AND
INCIDENT_ID IN (
SELECT
INCIDENT.INCIDENT_ID
FROM
INCIDENT
LEFT OUTER JOIN INC_DATA ON
INCIDENT.INCIDENT_ID = INC_DATA.INCIDENT_ID
WHERE
INCIDENT.DATE_LOGGED BETWEEN add_months((last_day(SYSDATE))+1,-6) AND add_months((last_day(SYSDATE))+1,-1) AND
(CSG_ID = '1' OR CSG_ID = '7') AND
INC_DATA.EVENT_TYPE = 'i' AND
(INCIDENT.INC_STATUS = 'c' OR INCIDENT.INC_STATUS = 'p')
)
GROUP BY INCIDENT_ID
ORDER BY ZUWEISUNGEN ASC
So the query returns only two fields in CR, which are INCIDENT_ID and ZUWEISUNGEN.
Sorry for bothering you so much!!!
Hi Eberhard,
Modify your SQL as below : added start date and end date to SQL
SELECT
INCIDENT_ID,
COUNT(ACT_TYPE_ID) - (SELECT COUNT(*) FROM act_reg a2 WHERE act_reg.incident_id = a2.incident_id AND act_type_id = 6) AS ZUWEISUNGEN, add_months((last_day(SYSDATE))+1,-6) AS START_DATE, add_months((last_day(SYSDATE))+1,-1) AS END_DATE
FROM
ACT_REG
WHERE
ACT_TYPE_ID = 1 AND
(ACT_REG.ASSYST_USR_ID != '473' or ACT_REG.ASSYST_USR_ID != '712' or ACT_REG.ASSYST_USR_ID != '323' or ACT_REG.ASSYST_USR_ID != '780') AND
ACT_REG.SERV_DEPT_ID = 28 AND
ACT_REG.***_SVD_ID <> 28 AND
INCIDENT_ID IN (
SELECT
INCIDENT.INCIDENT_ID
FROM
INCIDENT
LEFT OUTER JOIN INC_DATA ON
INCIDENT.INCIDENT_ID = INC_DATA.INCIDENT_ID
WHERE
INCIDENT.DATE_LOGGED BETWEEN add_months((last_day(SYSDATE))+1,-6) AND add_months((last_day(SYSDATE))+1,-1) AND
(CSG_ID = '1' OR CSG_ID = '7') AND
INC_DATA.EVENT_TYPE = 'i' AND
(INCIDENT.INC_STATUS = 'c' OR INCIDENT.INC_STATUS = 'p')
)
GROUP BY INCIDENT_ID
ORDER BY ZUWEISUNGEN ASC
Now you will see 4 fields in your field explorer. Create a formula like :
'Number of incidents assigned by Service Desk in ' &Totext({START_DATE},'dd/MM/yyyy')&''
&Totext({END_DATE}, 'dd/MM/yyyy')
Thanks,
Sastry
Hi Eberhard,
try this :
SELECT
INCIDENT_ID,
COUNT(ACT_TYPE_ID) - (SELECT COUNT(*) FROM act_reg a2 WHERE act_reg.incident_id = a2.incident_id AND act_type_id = 6) AS ZUWEISUNGEN,add_months((last_day(SYSDATE))+1,-6) AS START_DATE,add_months((last_day(SYSDATE))+1,-1) AS END_DATE
FROM
ACT_REG
WHERE
ACT_TYPE_ID = 1 AND
(ACT_REG.ASSYST_USR_ID != '473' or ACT_REG.ASSYST_USR_ID != '712' or ACT_REG.ASSYST_USR_ID != '323' or ACT_REG.ASSYST_USR_ID != '780') AND
ACT_REG.SERV_DEPT_ID = 28 AND
ACT_REG.***_SVD_ID <> 28 AND
INCIDENT_ID IN (
SELECT
INCIDENT.INCIDENT_ID
FROM
INCIDENT
LEFT OUTER JOIN INC_DATA ON
INCIDENT.INCIDENT_ID = INC_DATA.INCIDENT_ID
WHERE
INCIDENT.DATE_LOGGED BETWEEN add_months((last_day(SYSDATE))+1,-6) AND add_months((last_day(SYSDATE))+1,-1) AND
(CSG_ID = '1' OR CSG_ID = '7') AND
INC_DATA.EVENT_TYPE = 'i' AND
(INCIDENT.INC_STATUS = 'c' OR INCIDENT.INC_STATUS = 'p')
)
GROUP BY INCIDENT_ID,
add_months((last_day(SYSDATE))+1,-6) ,
add_months((last_day(SYSDATE))+1,-1)
ORDER BY ZUWEISUNGEN ASC
I have added start and end date fields to group by caluse. I hope this will resolve your issue.
Thanks,
Sastry
Yes its possible!!
Insert a Text Field and then just Drag the SQL expression or Formula on that Text Field it will get embedded,
Regards
Niraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok so Create a Formula lets say with Name Test Where you are getting your periods based on your Calculation or what Abhilash suggested.
Then Insert a Text Field on your report at desired location type your Text on that Text Box "Number of incidents assigned by Service Desk in" and then just pull that formula from the Formula section and drop it on that text field you created So you will see something like
Number of incidents assigned by Service Desk in {@Test} in your text box in design mode. When you run this report the value returned by that formula will get displayed along with the text.
Another solution what Abhilash suggested is also a way to get that done
Regards
Niraj
User | Count |
---|---|
65 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.