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

We are happy to announce the new Windchill Customization board! Learn more.

How to go from VR: to OR: ?

tbusch
1-Newbie

How to go from VR: to OR: ?

Hey guys! I've got a query-objects webject doing a lookup for me, and then I'm taking the OBIDs of the returned objects and turning them into Java objects in my Java API... but I've got an issue -- when a webject returns a VR: obid, I can't resolve the reference because Windchill tells me "it no longer exists."

So what I'm looking for is a way to either look up the OR: obid that corresponds to the VR: obid I got from the webject, or some way to resolve the VR: obid to a java object somehow.

Any help is appreciated, thanks for your time!

-Tom

7 REPLIES 7
ddemay
1-Newbie
(To:tbusch)


Tom you are getting more knowledable every day. This is not too hard to do.

The key is knowing that the number for VR in oracle is different from the primary key object reference column: the ida2a2

The VR number is repeated and shared on a per iteration basis meaning that all iterations to that mastered/revision controlled object are the same. VR also will direct you to the latest iteration of the latest rev.

Keep in mind that each iteration still also has its own OR = ida2a2.

You can use the logical attribute report to see all of these. VR is known as the branchIdentifier. For example.

As for code goes, I can write up an example to share with you shortly. Writing info*engine on a blackberry is'nt easy. You can request oid as an attribute in Info*Engine even if the UFID (federated ID) is returned in the XML

If you want the java code to convert VR to OR I can provide that also. Please let me know what you need.


Dave



Sent from my Verizon Wireless BlackBerry

This question was asked quite some time back. I'm not sure it got resolved.


Is there a piece of code that will derive an OR from a VR?


Mant Thanks,



Derek

Hi Derek,



I think the following piece of code should be working:



public static String getORFromVR(String vr) throws WTException {


vr = vr.substring(0, vr.lastIndexOf(":"));


ReferenceFactory rf = new ReferenceFactory();


WTReference ref;


ref = rf.getReference(vr);


WTObject lct = (WTObject) ref.getObject();


ObjectReference objRef = ObjectReference.newObjectReference(lct);


return objRef.getKey().toString();


}



Kind Regards


Maciej Grodzki

Many Thanks for the reply, Maciej. I'll try it out.



Regards,



Derek

//When you have string value contains VR



WTReference ref = refFactory.getReference(oid);


//When you have obj


VersionReference versionReference = VersionReference.newVersionReference(partVersion);



businessObjRef = "VR:" + businessObjRef.replace('>',':');



Ayyappan

Ayyappan


Thanks for filling this in. Very helpful.


Regards,



Derek

Maciej/Ayyappan,


Thanks to both of you. This helps move things along.


Regards,



Derek


Top Tags