You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2012-10-24 21:58:49

danh
Member
From: Chicago, USA
Registered: 2012-03-08
Posts: 546
Website

Reports Plugin - Output Help Needed

I am trying to combine user first name with last name in the output.
Nothing is working yet.

I can use:
new PluginReportsColumn('name2','Password Reset For:'),
new PluginReportsColumn('name3',' '));

It works, but it's not pretty.  How can I get them to both be in the same output field?

I am using glpi_users.firstname and  glpi_users.realname fields


Thanks,
Dan

Offline

#2 2012-10-29 17:44:35

tomolimo
Member
From: Grenoble, France
Registered: 2009-05-12
Posts: 515

Re: Reports Plugin - Output Help Needed

Dear danh,
You have two solutions:
Either to create a virtual field in the SELECT clause in your SQL request, or what I'm doing most of the time is to use a mySQL 'view' that I later use in my report.
regards,
Tomolimo

Last edited by tomolimo (2012-10-29 17:48:08)


GLPI 9.2.4 - PHP 7.2.13 x64 / ProcessMaker 3.3.0-community-RE-1.7 - PHP 7.1.24 x64 / Windows 2012 x64 / IIS 8.5 / MySQL 5.7.17 x64
Worldwide: >12316 PC, >9400 users (16 languages, >11 timezones), >360k tickets, >3600 entities, >4200 groups
Raynet is ARaymond (http://www.araymond.com) IT service management

Offline

#3 2012-10-30 15:57:49

danh
Member
From: Chicago, USA
Registered: 2012-03-08
Posts: 546
Website

Re: Reports Plugin - Output Help Needed

I have created the view, but I am not able to call this in the actual SQL statement.

Here is what I am working with:

$sql="SELECT glpi_tickets.name as name1, glpi_tickets.Date, glpi_tickets.content, glpi_users.realname as name3, glpi_users.firstname as name2
FROM (glpi_tickets_users INNER JOIN glpi_tickets ON glpi_tickets_users.tickets_id = glpi_tickets.ID) INNER JOIN glpi_users ON glpi_tickets_users.users_id = glpi_users.ID
WHERE (((glpi_tickets.itilcategories_id)=32) AND ((glpi_tickets_users.type)=1))";

Thanks,
Dan

Offline

#4 2012-10-30 16:02:49

tomolimo
Member
From: Grenoble, France
Registered: 2009-05-12
Posts: 515

Re: Reports Plugin - Output Help Needed

Try this:

SELECT glpi_tickets.name as name1, glpi_tickets.Date, glpi_tickets.content, CONCAT(glpi_users.realname, ' ' , glpi_users.firstname ) as UserName

regards,
Tomolimo


GLPI 9.2.4 - PHP 7.2.13 x64 / ProcessMaker 3.3.0-community-RE-1.7 - PHP 7.1.24 x64 / Windows 2012 x64 / IIS 8.5 / MySQL 5.7.17 x64
Worldwide: >12316 PC, >9400 users (16 languages, >11 timezones), >360k tickets, >3600 entities, >4200 groups
Raynet is ARaymond (http://www.araymond.com) IT service management

Offline

#5 2012-10-30 16:08:14

danh
Member
From: Chicago, USA
Registered: 2012-03-08
Posts: 546
Website

Re: Reports Plugin - Output Help Needed

That works awesome.  Thank you very much!


Thanks,
Dan

Offline

Board footer

Powered by FluxBB