Ticket numbers in CSV export

Moderator: crythias

Locked
aph
Znuny superhero
Posts: 646
Joined: 20 Jun 2014, 12:11
Znuny Version: 3.3.9, 4.x, 5.x

Ticket numbers in CSV export

Post by aph »

I noticed the following when I export search results to a csv and open it, the ticket numbers are displayed as 2,01506E+15 and so on. On formatting the cell as a number, excel displays ....10000050 as ticket number. However, this is wrong as the correct ticket number should be ....10000059. Is there a way to add for example a # in front of the ticket number during export so it is treated as text instead of a number? Or could anyone give me a hint as to how I can format the cell correctly?
OTRS 3.3.x (private/testing) on Windows Server 2008 with MSSQL database.
OTRS 3.3.x (private/testing) on CentOS with MySQL database and apache
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Ticket numbers in CSV export

Post by crythias »

This is a problem with Excel, and it will round the last digit, too. A way to get around this is to manually import csv and make sure the column is text. Or modify the column to be preceded with an apostrophe (').
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
aph
Znuny superhero
Posts: 646
Joined: 20 Jun 2014, 12:11
Znuny Version: 3.3.9, 4.x, 5.x

Re: Ticket numbers in CSV export

Post by aph »

Manually importing the csv is problematic as one of the exported fields is a textarea and contains line breaks. Thus, the text moves into the first column.

How can I modify the column to be preceded with an apostrophe before opening the csv, since as soon as I open the csv the numbers are either in scientific format or when formatted to number round the last digit?
OTRS 3.3.x (private/testing) on Windows Server 2008 with MSSQL database.
OTRS 3.3.x (private/testing) on CentOS with MySQL database and apache
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Ticket numbers in CSV export

Post by jojo »

OTRS4 does allow a special CSV file to be exported for Excel usage
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
aph
Znuny superhero
Posts: 646
Joined: 20 Jun 2014, 12:11
Znuny Version: 3.3.9, 4.x, 5.x

Re: Ticket numbers in CSV export

Post by aph »

I could do a search and replace using regex. In notepad++ replace ^"\d with "'2. This should be sufficient until we reach the year 3000 as the first part of ticket is the year and thus first digit is 2.

However, this would mean agents having to do the dirty work. I would be interested to know if I could edit the the ticket number with an apostrophe during export.

I'd be thankful about pointers regarding how the data is written into the csv file from OTRS and possibly a way to manipulate it.

EDIT: @jojo I have version 3.3.x though :D. Certainly a reason to upgrade to 4.x, but I would like to customize the code to add an apostrophe to the ticket number instead of doing an upgrade to solve the issue.
OTRS 3.3.x (private/testing) on Windows Server 2008 with MSSQL database.
OTRS 3.3.x (private/testing) on CentOS with MySQL database and apache
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Ticket numbers in CSV export

Post by crythias »

what column is the ticket number in for your export?
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
aph
Znuny superhero
Posts: 646
Joined: 20 Jun 2014, 12:11
Znuny Version: 3.3.9, 4.x, 5.x

Re: Ticket numbers in CSV export

Post by aph »

It is the first column ticket number. It is field TicketNumber configured in Ticket::Frontend::AgentTicketSearch###SearchCSVData in Ticket -> Frontend::Agent::Ticket::ViewSearch
OTRS 3.3.x (private/testing) on Windows Server 2008 with MSSQL database.
OTRS 3.3.x (private/testing) on CentOS with MySQL database and apache
aph
Znuny superhero
Posts: 646
Joined: 20 Jun 2014, 12:11
Znuny Version: 3.3.9, 4.x, 5.x

Re: Ticket numbers in CSV export

Post by aph »

Any Ideas how I can manipulate the ticket number as a string in the csv output during export?
OTRS 3.3.x (private/testing) on Windows Server 2008 with MSSQL database.
OTRS 3.3.x (private/testing) on CentOS with MySQL database and apache
Locked