Quantcast
Channel: PTC Community : Document List - All Communities
Viewing all articles
Browse latest Browse all 1247

How to get a text list of folder names in Product Container

$
0
0

Step One

 

Copy the codes below:

 

1

 

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

 

package ext;

 

 

import java.util.Vector;

import wt.folder.SubFolder;

import wt.inf.container.WTContainerHelper;

import wt.inf.container.WTContainerRef;

 

publicclass MyWindchillUtility {

 

    //Get a text list of folder names in a product container

    publicstatic WTContainerRef getContainerRef(String orgName, String productName) {

        WTContainerRef containerRef =null;

        try {

            if (productName !=null&& !"".equals(productName))

                containerRef = WTContainerHelper.service.getByPath("/wt.inf.container.OrgContainer="+ orgName +"/wt.pdmlink.PDMLinkProduct="+ productName);

            else

                containerRef = WTContainerHelper.service.getByPath("/wt.inf.container.OrgContainer="+ orgName);

        } catch (Exception e) {

            e.printStackTrace();

        }

        return containerRef;

    }

 

    publicstaticvoid folderDriver() {

     

        WTContainerRef wtcontainerref = DGUtil.getContainerRef("LIGADP", "Test1");  //<Organization Container Name>, <Product Container Name>

        String oid = DGUtil.getStringOid(wtcontainerref.getContainer());

        Vector v = (Vector)DGUtil.getSubFolderWithContainer(oid);

        for(int i=0;i<v.size();i++){

            SubFolder sf = (SubFolder)v.get(i);

            System.out.println(sf.getFolderPath());

        }

    }

     

    publicstaticvoid main(String[] args) {

        MyWindchillUtility.folderDriver();     

    }

}

 

 

Colored by Color Scripter

cs

 

Step Two

 

Execute MyWindchillUtility on Windchill Shell:  windchill ext.MyWindchillUtility


image12.png


Viewing all articles
Browse latest Browse all 1247

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>