Skip to main content
1-Visitor
August 5, 2010
Question

How to go from VR: to OR: ?

  • August 5, 2010
  • 7 replies
  • 3498 views

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

1-Visitor
August 5, 2010

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
1-Visitor
August 12, 2014

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

11-Garnet
August 12, 2014

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

1-Visitor
August 12, 2014

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



Regards,



Derek

11-Garnet
August 12, 2014

//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

1-Visitor
August 12, 2014

Ayyappan


Thanks for filling this in. Very helpful.


Regards,



Derek

1-Visitor
August 12, 2014

Maciej/Ayyappan,


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


Regards,



Derek