This blog entry discusses the Representation Purging Utility that I created. It was written as a jsp with an html front end page. The files are attached.
As CAD Documents are iterated in Windchill, published representations accumulate in the history and most of those representations are no longer needed. If the OOTB publishing rules are used, every iteration will have multiple representations as shown below. This screenshot shows four representations for a single version of this CAD Document, and there are a total of ten versions in the history of this CAD Document. As you can imagine, the number of representations can grow quickly.
The majority of the time, we only need one default, as-stored representation, so most of the representations can be safely deleted. There is no OOTB tool, that I'm aware of, that can be used to delete these undesired representations in bulk, so I created this tool to delete them. It allows me to free up valuable storage space in the vaults. If your representations have value and you want to retain the full history including all representations and any possible annotations that might exist, do not use this tool.
To run the tool, copy the html and jsp file to the same folder on your Windchill server under the codebase directory. In a browser enter the address to the html page, e.g. http://yoursite.com/Windchill/infoengine/jsp/tools/DeleteRepsUI.htm. The html page offers the opportunity to enter filtering options:
The entries and notes are self-explanatory. As the job runs, the time, options and a list of purged representations are logged to a file that is located in the same directory as the jsp file. Running this utility only deletes the reference in the database to the representation files. To complete the purging process, unreferenced files must be deleted from the vaults by running Site > Utilities > File Server Administration > Vault Configuration > Remove Unreferenced Files on the vaults.
This utility can be run by any Windchill (web server) authenticated user. It's meant to be an admin tool and I share the link cautiously.
I have tested it to some extent but would welcome additional testing. Let me know in the comments if you have any questions about options, find any problems or have any recommendations.
I've also posted some other utilities that might be of interest to you in this blog entry: Windchill - Custom Utility Examples
EDIT: Added option to exclude representations with annotations.
EDIT: Added more error catching around the representation deleting. 14-APR-2016
Warning: Use my code at your own risk, and test before implementing in production. Running this utility can delete potentially all of the representations in your Windchill system.
Disclaimer: This software is provided AS IS without warranty of any kind. I disclaim all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the software and documentation remains with you. In no event shall I or anyone else involved in the creation, production, or delivery of the software be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the software or documentation, even if I have been advised of the possibility of such damages.
Have you used it? Did you find any problems?
Yes ! For now, no problem
Hi Darrell McAlister, when I try to use this, I get following error:
org.apache.jasper.jasperException: Unable to compile class for JSP:
An error occured at line: 174 in the jsp file: /infoengine/jsp/examples/Deletereps.jsp
The method isDefaultRepresentation() is undefined for the type Representation
Do you know why this is happening. I am using Windchill 10.1 M020
I looked at the Javadoc for 10.1 and the isDefaultRepresentation() method isn't listed for Interface _Representation which I am using in the code. Looks like it was introduced after. I do see a getDefaultRepresentation() boolean method in 10.1 that no longer exists in 10.2+. It might work in place of isDefaultRepresentation(). It is possible they renamed it. They usually use is (not get) with Booleans.
Thanks Darrell for pointing me to the right direction. That suggestion works!
Thanks for your utility, I tested in windchill 11 M030.
For run your utility I put the program and link in this folder : E:\Ptc\Windchill_11.0\Windchill\codebase\wtcore
and the link for run : http://yoursite/Windchill/wtcore/DeleteRepsUI.html
I set the value for delete 60.000 representation, and after ~ one hour I see the log file, and I look that the representations deleted are ~ 18.000.
I freed up more than 220 GB of space on my hard drive.
I have not yet understood all the commands of your program, but I find it very useful.
Nifty little tool. Thanks for sharing.