Quantcast
Channel: PTC Community: Message List - Windchill
Viewing all articles
Browse latest Browse all 8876

Re: How to get last version by code

$
0
0

Hi Vasiliy. I guess this code will helpfull for you.

 

public WTDocument getWTDocByNumber(String number)

    {

        WTDocument wtd = new WTDocument();

        WTDocumentMaster wtdm = null;

        try

        {

            QuerySpec qs = new QuerySpec(WTDocumentMaster.class);

            qs.appendWhere(new SearchCondition(WTDocumentMaster.class, "number", "=", number), 0);

            QueryResult find = PersistenceHelper.manager.find(qs);

            if (find.hasMoreElements())

            {

              wtdm = (WTDocumentMaster)find.nextElement();

            }

            try {

                wtd.setMaster((Mastered)wtdm);

            } catch (WTPropertyVetoException ex) {System.out.println(ex);}

        }

        catch (WTException ex)

        {

            ex.printStackTrace();

        }

        return wtd;

    }


Viewing all articles
Browse latest Browse all 8876

Trending Articles



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