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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

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

Cat
10-Marble
10-Marble

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

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;

public class MyWindchillUtility {

 

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

    public static 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;

    }

 

    public static void 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());

        }

    }

     

    public static void main(String[] args) {

        MyWindchillUtility.folderDriver();     

    }

}

Colored by Color Scripter

cs

Step Two

Execute MyWindchillUtility on Windchill Shell:  windchill ext.MyWindchillUtility


image12.png

1 REPLY 1

What's the definition of DGUtil? Is it a custom class where you are manually retrieving the information?

Announcements


Top Tags