Written by: Bryce Hooper, Application Engineer
SOLIDWORKS PDM Professional gives us the ability to generate reports from the SQL database, without opening SQL Management Studio. This is a benefit in scenarios where Engineering wants information that IT isn’t allowing them to have by restricting SQL access. To run reports, a user must be granted permission on a user or group level. This is set in the Administration tool under “Administrative Permissions”. You’ll find this permission in the same place for both users and groups.
Once this is enabled, a user can launch the report generator tool by navigating to any folder in the local vault view and going to Tools > Report Generator.
The dialog is likely to look blank at first
We can change that with some examples that SOLIDWORKS provides for us and, in another article, some queries of our own. To get these examples we need to get the CRP file out of our installed directory.
A typical directory will look something like C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS 20XX\SOLIDWORKS PDM\.
This may change depending on your installation location and version. The file we are looking for is “Report Examples 1.crp”. We add this file by going to the File > Import Queries menu option. This will launch an open dialog looking for any CRP files. Select this file and click open.
Each time we add a report, the tool will ask us how we want to assign permissions for those able to see the report generator. This gives us a more granular control of who can see which reports.
Be mindful to make sure that you have your own user selected.
The Admin user will always be selected by default and cannot be deselected, so don’t worry about accidentally removing rights for all users. Once we have cleared this dialog for each report that is added (for the example reports this is quite a few), we will get a number of total queries added. From here, we can generate reports and get some data.
To run specific reports check the box in the upper left pane. It is possible to run as many reports as you’d like at a time. Keeping in mind, if your reports have similar input requests things can get confusing. If your report needs to deal with files and is configured to use a selected file (without a prompt), files can be added to the selection by going to File > Add files to selection.
In the screenshot above I have added my Toy Car model to query against its Tree structure. When we’re ready to run, click the green play button or go to Edit > Execute Query. The results of each report will show in the bottom pane. This information can be exported as a comma delimited file (CSV) which can be opened in Excel for ease of use.
Writing custom reports can be a daunting task. SOLIDWORKS provides us some help on this in the Knowledgebase Article S-013369. We also explore this a little bit in another blog article.