> As we all know in Pro E we have the option to add multiply > models into certain drawing. > > is their any way to run search/sql script to get list of all > related models to specific drawing ?
This query should list drawing models (DGDEPTYPE=4) for drawing 'my_drawing.drw':
-- drawing models for a specific drawing -- column parent format a35 column child format a35
select distinct parent_pi.piname as parent, child_pi.piname as child, dg.DGDEPTYPE, dg.DGDEPCOUNT from pdm.PDM_PRODUCTITEM child_pi, pdm.PDM_DEPENDENCYGRAPH dg, pdm.PDM_PRODUCTITEM parent_pi, pdm.PDM_BRANCH parent_br, pdm.PDM_PRODUCTITEMVERSION parent_piv where parent_pi.piname='my_drawing.drw' and dg.DGDEPTYPE=4 and dg.piid=child_pi.piid and dg.pivid=parent_piv.pivid and parent_br.brid=parent_piv.brid and parent_pi.piid=parent_br.piid ;
This query should list all drawings that have multiple drawing models (DGDEPTYPE=4) associated to them. Seems that this is more what you were looking for:
-- drawings with multiple models -- column parent format a35
select parent_pi.piname as parent, dg.DGDEPTYPE, count(distinct child_pi.piname) as child_count from pdm.PDM_PRODUCTITEM child_pi, pdm.PDM_DEPENDENCYGRAPH dg, pdm.PDM_PRODUCTITEM parent_pi, pdm.PDM_BRANCH parent_br, pdm.PDM_PRODUCTITEMVERSION parent_piv where dg.DGDEPTYPE=4 and dg.piid=child_pi.piid and parent_pi.pitypeid in ( select pitypeid from pdm.PDM_PITYPEDEF where pitname='Drawing' ) and dg.pivid=parent_piv.pivid and parent_br.brid=parent_piv.brid and parent_pi.piid=parent_br.piid group by parent_pi.piname,dg.DGDEPTYPE having count(distinct child_pi.piname) > 1 ;
The 'distinct' keyword in the 'select' and 'having' clauses causes oracle to treat multiple occurrences of the same drawing model as one occurrence. Eliminate the keyword and you will get more results.
> Truth, it can be done manually, for each drawing, however I > would like to go over the entire DB...
You can do the above with Intralink Scripting in Java, much more slowly, but the results will probably be somewhat more accurate.