Store SQL statement as template report

Moderator: crythias

Post Reply
laylawan
OTRS newbie
Posts: 7
Joined: 06 Apr 2018, 11:24
OTRS Version?: Version 6

Store SQL statement as template report

Post by laylawan » 09 Aug 2018, 08:20

Dear all,
I would like to extract the parent and child ticket in a report but found that there is no such template report in Statistics. So I have type my SQL statement to get the data that I needed. However, can I save this SQL statement as a template for report/ statistics? As I would like to let user to generate the report by themselves and no need to input the SQL.

Here is my SQL statement:
SELECT id as Ticket_ID, title, target_key as Child_ticket FROM
(select id, title from ticket) as ID
left join
(select source_key, target_key from link_relation) as SK
on ID.id = SK.source_key
order by ID ASC

Thanks & regards,
Layla

zzz
OTRS superhero
Posts: 216
Joined: 15 Dec 2016, 15:13
OTRS Version?: 3.x - 6.0.x
Real Name: Emin
Company: maxence business consulting GmbH
Contact:

Re: Store SQL statement as template report

Post by zzz » 20 Aug 2018, 08:03

Hello Layla,

that is possible by creating a static statistic (Perl programming needed) in OTRS.
However, the documentation for statis statistics is very poor.

Best regards
Emin

laylawan
OTRS newbie
Posts: 7
Joined: 06 Apr 2018, 11:24
OTRS Version?: Version 6

Re: Store SQL statement as template report

Post by laylawan » 21 Aug 2018, 03:17

Dear Emin,

Thanks for your information. However, the static statistics in my OTRS is greyed out. I am using OTRS 6.
stat.jpg
How can I enable it?

Thanks & regards,
Layla
You do not have the required permissions to view the files attached to this post.

zzz
OTRS superhero
Posts: 216
Joined: 15 Dec 2016, 15:13
OTRS Version?: 3.x - 6.0.x
Real Name: Emin
Company: maxence business consulting GmbH
Contact:

Re: Store SQL statement as template report

Post by zzz » 21 Aug 2018, 07:40

Hello Layla,

you have to create a custom Perl module in Kernel/System/Stats/Static/

Example

Best regards
Emin

laylawan
OTRS newbie
Posts: 7
Joined: 06 Apr 2018, 11:24
OTRS Version?: Version 6

Re: Store SQL statement as template report

Post by laylawan » 21 Aug 2018, 08:59

Dear Emin,

Thanks for your reply. But it seems a little bit difficult. ><

Regards,
Layla

Post Reply