snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

Custom SQL-Reports

Open Louis-Kre opened this issue 8 years ago • 12 comments

Server (please complete the following information):

  • Snipe-IT Version : 4.5.
  • OS: Ubuntu 16.04
  • Web Server: Apache2
  • PHP Version: 7.0

Is your feature request related to a problem? Please describe. We need special reports for some categories. For example an report for all mobile devies and another one for all desktops. Every report has a different structure other columns. Currently we have to download all columns that we need and import this in Excel, where we musst filter and sort everything. It is not so cool to download more than 400 rows, but you need only 20 rows...

Describe the solution you'd like It would be cool, when you can register an custom view in the system and could show them in the frontend. If you want to open, the system selects all columns from this view and display them in the frontend.

So we could create an SQL-View and could use them every time without export to excel.

Describe alternatives you've considered The next step could be filtering in the frontend or manage rights.

Additional context

Thank you, I'l looking forward for an implementation.

Louis-Kre avatar Jul 26 '18 19:07 Louis-Kre

Can you not just use the Categories view and export from there? For example: https://demo.snipeitapp.com/categories/1

Click on the export button and whatever is currently displayed on screen gets exported to a file.

snipe avatar Jul 26 '18 19:07 snipe

(Additionally, you can select the category from the Custom Asset Report - https://demo.snipeitapp.com/reports/custom )

snipe avatar Jul 26 '18 19:07 snipe

Yes thats correct, but than you get one file with the current status. And for some reports we want to combine information that are not possible with this default layout. For example: I want a table that contains all companies and all departments and a column, which contains the amount of laptops in this departments and so on.

We need a lot of such statistics for the finance department and for our it-statistics.

Louis-Kre avatar Jul 26 '18 19:07 Louis-Kre

You would have to use the API to generate that information.

The relationships between the different items in the system are pretty complicated, so I'm not sure arbitrary reports like what you're describing would be feasible.

snipe avatar Jul 26 '18 19:07 snipe

I created some SQL-Views to combine this information. For example, get all checkout assets and select the location (from the user or the checkout location hinself) and combine them with parent-location, like a department. And know I could build an Excel-File that select all rows from the view an display them in the file.

But it would be nicer to have this reports in the snipe-it frontend.

I know custom reports could be very complicated for some users, but if you know how its work, you could build some helpfull reports.

Louis-Kre avatar Jul 26 '18 19:07 Louis-Kre

SELECT departments.name as 部门名称, sum(departments.name='财务') as 财务, sum(departments.name='技术') as 技术, sum(departments.name='品管部') as 品管部 FROM assets,companies,users,departments WHERE assets.company_id=companies.id AND assets.assigned_to=users.id and department_id=departments.id

I have the same request ,but I login to my mysql server and run the SQL of above in snipeit database,

huangshifang avatar Jul 29 '18 01:07 huangshifang

I know custom reports could be very complicated for some users, but if you know how its work, you could build some helpfull reports.

We know how it works - we built it. My point is that arbitrary SQL reports aren't going to be possible.

snipe avatar Aug 01 '18 10:08 snipe

Is this still relevant? We haven't heard from anyone in a bit. If so, please comment with any updates or additional detail. This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Don't take it personally, we just need to keep a handle on things. Thank you for your contributions!

stale[bot] avatar Sep 30 '18 10:09 stale[bot]

Is it not possible to create a "select * from view_xxx" and display this table in the frontend? So we could generate our own SQL-Reports and share them in the frontend?

Thanks for your support.

Louis-Kre avatar Sep 30 '18 14:09 Louis-Kre

Okay, it looks like this issue or feature request might still be important. We'll re-open it for now. Thank you for letting us know!

stale[bot] avatar Sep 30 '18 14:09 stale[bot]

Is this still relevant? We haven't heard from anyone in a bit. If so, please comment with any updates or additional detail. This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Don't take it personally, we just need to keep a handle on things. Thank you for your contributions!

stale[bot] avatar Nov 29 '18 15:11 stale[bot]

This issue has been automatically closed because it has not had recent activity. If you believe this is still an issue, please confirm that this issue is still happening in the most recent version of Snipe-IT and reply to this thread to re-open it.

stale[bot] avatar Dec 06 '18 15:12 stale[bot]