Retrieving a BOM table of an item in an old revision
Hi all,
if I use this instruciotn (for example)
ITable bomTable = currentItem.getTable(ItemConstants.TABLE_BOM);
it will retrieve the BOM table of the item in its last revision. How can I tell to the script to retrieve the BOM of that item in another revision? For example, if the item is release din rev. 05 I would like to retrieve the BOM it has in revision 02; is it possible?
Try This:
IItem currentItem .... String myRevision = "02"; currentItem .setRevision(myRevision); ITable bomTable = currentItem.getTable(ItemConstants.TABLE_BOM); ...
with setRevision you can put an IChange instance or the version number.
Once this setRevision, you can got all version information from the item. It is the same operation that you do in the webclient changing the version from the select menu
Thank you again!
I have another question: how can I retrieve the latest released revision of an item? I use the getRevision() instruction but, if an object has a pending change, it returns the new revision in brackets.
My case is this: If I unrelease a change order I’d like to have the previous revision of the item (i.e. the latest released one), not the one it would have after the release of the change.
If you get the Item from the Affected item Tab, you will get always the pending revision if you call getRevision().
You can open the item from the session using the numberÂ
IItem item = (IItem) session.getObject(IItem.OBJECT_TYPE, "P12345"); item.getRevision(); //returns the latest released version.
If you have to get anyway the item from the Affected item tab, you can get the Last Rev field value and set the item revision to it.
for example
ITEM NUMBER Â Â Â Â Â LAST REV Â Â Â Â NEW REV
ITEM123 Â Â Â Â Â Â Â Â Â Â Â 2 Â Â Â Â Â Â Â Â Â Â Â Â Â 3
currItemRow :Â affectedItem
{
currItem.setRevsion(currItemRow.getValue(LASTREV))
//now item is set for version 2.
}
Antonio, please forgive me for my ignorance, but I can’t find how to mark the question as answered. I don’t see any button to do that.
under the arrow to vote down an answer, you as owner of the question should see another button with a check. You can click on this button to mark the answer as best one