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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

I want to find the previous version of the part which is having version as AA alphabetic

ashiq_097
3-Visitor

I want to find the previous version of the part which is having version as AA alphabetic

Version: Windchill 12.0

 

Use Case: i was using allversionsfrom(Versioned versioned) to fetch the all versions as to first record version. But for alphabetic version like AA AB im not getting the previous version, please assist


Description:

i was using allversionsfrom(Versioned versioned) to fetch the all versions as to first record version. But for alphabetic version like AA AB im not getting the previous version, please assist

3 REPLIES 3
HelesicPetr
22-Sapphire I
(To:ashiq_097)

Hi @ashiq_097 

Please share what configuration do you use for the versioning schema.

What do you expect and what you get. for example, I want the previous version from AB and I do not get AA please describe it more widely 

How the code is written? It could help to test it and help you.

PetrH

hi @HelesicPetr thanks for your response.. we have revision as Double Alphabetic characters as i was trying to use below snippet code to extract the previous released revision details but I'm getting only AB Version in the result.. please assist

public static WTPart getPreviousRevision(RevisionControlled object) {
LOGGER.debug("Enter -->getPreviousRevision");
RevisionControlled retValue = null;
WTPart prevVersion = null;
String actualRev = object.getVersionIdentifier().getVersionSortId();
 
try{
QueryResult allVersions = VersionControlHelper.service.allVersionsFrom(object);
RevisionControlled prevRevision = null;
while (allVersions.hasMoreElements()) {
    Object obj = allVersions.nextElement();
    if (obj instanceof RevisionControlled) {
    String checkRevision = ((RevisionControlled) obj).getVersionIdentifier().getVersionSortId();
    if (checkRevision.equals(actualRev)){
    // next version
    }else{
    RevisionControlled subprevRevision = (RevisionControlled) obj;
    State state = subprevRevision.getLifeCycleState();
    if (state.equals(State.toState("RELEASED"))) {
    prevRevision = subprevRevision;
    break;
    }else{
    actualRev = subprevRevision.getVersionIdentifier().getVersionSortId(); 
    }
    }
    }
}
if (prevRevision != null)
{
retValue = prevRevision;
prevVersion = (WTPart)retValue;
}
}catch (WTException e){
LOGGER.error("getPreviousRevision - Resulting ObjectsPOC" + e);
}
LOGGER.debug("Exit -->getPreviousRevision");
return prevVersion;
}

part_detailsPNG.PNG

is there any API to Pull this versions as well ?

Top Tags