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

i'm using next code:

public static Object getLatestByConfigSpec(Mastered mastered, Iterated iterated) throws WTException

{

    Object tempObject = null;

    Object resultObject = null;

 

    long id = 0;

    QueryResult cQueryResult = ConfigHelper.service.filteredIterationsOf(mastered, ConfigHelper.service.getConfigSpecFor(iterated));

    while(cQueryResult.hasMoreElements())

    {

        tempObject = cQueryResult.nextElement();

        if(PersistenceHelper.getObjectIdentifier((Persistable) tempObject).getId() > id)

        {

            id = PersistenceHelper.getObjectIdentifier((Persistable) tempObject).getId();

            resultObject = tempObject;

        }

    }

 

    return resultObject;

}


Viewing all articles
Browse latest Browse all 8876

Trending Articles



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