The community will be in read-only from Monday 11:59pm (PT) to Wednesday 7:30am (PT)
The community will be in read-only from Monday 11:59pm (PT) to Wednesday 7:30am (PT)
Service Desk Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Perl Scripting

Highlighted
Declan Weir
Occasional Contributor

Perl Scripting

I am trying to write a script in perl that generates reports from a CSV file exported from SD.

I was wondering if it is possible to export a view to a CSV file using scripts (perl) or from the command line e.g fire a query(SQL?) to the SD server. Thanks
3 REPLIES
Dwayne A
Member

Re: Perl Scripting

Hi Declan,

I not real sure what you are asking about exporting a view to CSV. But with with perl scripting it is possible to execute commandlne queries using sql on the Service Desk database. Perl uses DBI and DBD modules to faciliate connecting to databases.

What type of view are you in reference to?

Dwayne
Declan Weir
Occasional Contributor

Re: Perl Scripting

The view I am referring to is the "View" from the menu on the top of the service desk window. I have a custom view defined for service calls which shows the fields like "TeamTrackID", "Status", "Priority", "Caller" etc.

To export the view to a CSV file click FIle --> Export --> To a file --> create a file of type [comma separated values] --> --> [finish]

My perl script processes this exported CSV file to generate some graphs. The CSV file has to be exported manually by someone and the perl script run.

My initial thought is to write some perl script that can directly retrieve information from the SD server. I am not sure what type of queries can be sent to the SD server (SQL ?), if so which table do I use to get "Service call" details, would my username, password, SD server IP and port be sufficient to fire an SQL query at the SD server?. A simple perl example showing how a connection is made and database queried would help me get started if possible, can I capture the perl scrips being used by SD on my machine as examples?.

Thanks and regards
Dwayne A
Member

Re: Perl Scripting

Declan,

attached is an example to query the database. it writes the output to a excel file. The database is oracle 10g and it uses the sqlplus feature to connect. Oracle is normally listening on port 1521. You can find the user and connection information on the Service Desk Server. under the Server Configuration option.

On the system -> system Resouces -> reportds settings is a data dictionary function that provides details to the database structure.

HTH

Dwayne
//Add this to "OnDomLoad" event