cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to search for a representation by name?

SOLVED
Highlighted
Opal

How to search for a representation by name?

Hey, 

I need to find all CAD Document representations named batch and delete them.  Any good ideas on how to go about that?

System: Windchill 10.1 m040

20150901-115320.png

Thanks for the help,

-marc

CAD / PLM Systems Manager

TriMark Corporation

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to search for a representation by name?

Mark - I think you can use delete rep utility - https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS62748

Matt has detailed it here Re-publish ideas needed

Thanks

Binesh Kumar

Barry Wehmiller

View solution in original post

7 REPLIES 7
Highlighted

Re: How to search for a representation by name?

Mark - I think you can use delete rep utility - https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS62748

Matt has detailed it here Re-publish ideas needed

Thanks

Binesh Kumar

Barry Wehmiller

View solution in original post

Highlighted

Re: How to search for a representation by name?

I tried to use this utility 3 years ago with no success...PTC drug their feet for months, then moved the case to R&D.  Then they came back with "it's an unsupported utility".  I had to enlist the help of our outside consultants who wrote a quick little program that deleted all reps name batch.  Supreme frustration with PTC at that point.  Good luck with the utility.

Highlighted

Re: How to search for a representation by name?

Hi Greg, I ran it for a couple of occasions it deleted the reps, but i had to do some tweaks. I have faced some memory issues and faced some deadlock as well. I am curious to know - did the utility run when you tried or was is doing a partial deletion?

Thanks

Binesh Kumar

Barry Wehmiller

Highlighted

Re: How to search for a representation by name?

Binesh, we were getting an error message...but it was three years ago and we were running 10.0.  Looks like the issue was fixed for 10.1 and 10.2.

ERROR: Delete representation utility is failing with rolling back database message. "ERROR : com.ptc.wvs.server.util.DeleteRepUtil wcadmin - Error deleting representations - Rolling back database transaction"

Highlighted

Re: How to search for a representation by name?

Binesh,  I am trying to run the utility now and am getting an ERROR.  The utility says "...wt.util.WTException: You are not authorized to run this program."   When I look at the method server log, it has a bunch of out of memory errors, that I am assuming are related somehow.

What did you do to get around the memory problems?   I have gone from running the utility on the whole site, to just the ORG, to now one single context in attempts to eliminate the problem.

-marc

Highlighted

Re: How to search for a representation by name?

Hi Marc,

You are right, just narrow it down to product context to eliminate the performance impact.

You can change the command itself  like below or

Delete representations named 'preview1' or 'preview2' from all Representables

    in the 'Demo2' Organization or in the product whose OID is 117583:

        DeleteRepUtil -CONT_PATH "wt.inf.container.OrgContainer=Demo2" \

                      -containerOID wt.pdmlink.PDMLinkProduct:117583 \

                      -repName "preview1" -repName "preview2"

Another option is to use the sql query to find out ids and provide the IDs as a list.

select derived.idA2A2 from DerivedImage derived, EPMDocument epmdoc, PDMLinkProduct prod where part.idA2A2=derived.idA3theRepresentableReferencand part.idA3containerReference=prod.idA2A2 and prod.namecontainerInfo='<product name=">';

Also use the option -q to run it quietly, this will increase the throughput.

Thanks

Binesh Kumar

Barry Wehmiller

Highlighted

Re: How to search for a representation by name?

Just to wrap things up,  I was able to use a SQL query to find all the representations named batch and then use the DeleteRepUtil to delete them.  I chose to use this method because it was faster and had less impact on the running production server.  The same results could be achieved using just the utility, but it was much more resource intensive and disruptive to the server and user performance was noticeably affected.

My Procedure:

  1. Log into DB server
  2. Start MS SQL Server Management Studio
    1. Login as db user
  3. Run SQL query
  4. Save results to text file.
  5. Copy text file to APP server.
  6. Break single large text file into smaller files of approximately 5000 lines each as needed to minimize impact to performance.
  7. Start Windchill shell
  8. Run DeleteRepUtil  with the -f option to read the file.

SQL Queries:  (Note, I am new to SQL, and borrowed heavily from the Community to put this together.  Also there may be better ways to accomplish the same thing...)

SQL Query (Product):  Change name for each product to run this against.

select

  derived.idA2A2

from

  DerivedImage derived, WTPart part , PDMLinkProduct prod

where

  part.idA2A2=derived.idA3theRepresentableReferenc and

  part.idA3containerReference =prod .idA2A2 and

  prod.namecontainerInfo ='<product name=">' and

  derived.name='batch'

Union All

Select

  derived.idA2A2

from

  DerivedImage derived, EPMDocument epmdoc , PDMLinkProduct prod

where

  epmdoc.idA2A2=derived.idA3theRepresentableReferenc and

  epmdoc.idA3containerReference =prod .idA2A2 and

  prod.namecontainerInfo ='<product name=">' and

  derived.name='batch' ;



SQL Query (Library): Change name for each library to run this against

select

  derived.idA2A2

from

  DerivedImage derived, WTPart part, WTLibrary lib

where

  part.idA2A2=derived.idA3theRepresentableReferenc and

  part.idA3containerReference=lib.idA2A2 and

  lib.namecontainerInfo='<library name=">' and

  derived.name='batch'

UnionAll

Select

  derived.idA2A2

from

  DerivedImage derived, EPMDocument epmdoc, WTLibrary lib

where

  epmdoc.idA2A2=derived.idA3theRepresentableReferenc and

  epmdoc.idA3containerReference=lib.idA2A2 and

  lib.namecontainerInfo='<library name=">' and

  derived.name='batch';

Note:  Replace <library name="> with name of library.   Likewise for <product name=">, replace with name of product.

Sample utility line syntax:

windchill com.ptc.wvs.server.util.DeleteRepUtil -f D:\20150902-batchreps\batchreps01.txt -u siteadmin -p password -q

Announcements