Community Tip - You can change your system assigned username to something more personal in your community settings. X
Hi.
How can i change WTPart revision by code?
I need something lika that:
from A.* to B.1;
from B.* to C.1;
from C.* to D.1
and so on.
* - any number.
Thanks.
Solved! Go to Solution.
Following code works on 9.1 M40
Versioned reviseObj(final Versioned versioned){
Versioned newVersioned = null;
try {
newVersioned = wt.vc.VersionControlHelper.service.newVersion(versioned);
wt.fc.PersistenceHelper.manager.store(newVersioned);
} catch (WTPropertyVetoException e) {
e.printStackTrace();
} catch (WTException e) {
e.printStackTrace();
}
return newVersioned;
}
Hi,
I have tried version changes directly in database using the SQL script given below:
SQL script for changing WTPart Version from A.2 to B.1
update WTPART set VERSIONIDA2VERSIONINFO='B', VERSIONSORTIDA2VERSIONINFO='0000011', ITERATIONIDA2ITERATIONINFO='1' where ida2a2 in (select P.IDA2A2 from WTPART P, WTPARTMASTER M where P.IDA3MASTERREFERENCE=M.IDA2A2 and P.VERSIONIDA2VERSIONINFO='A' and P.ITERATIONIDA2ITERATIONINFO='2' and M.WTPARTNUMBER='12345');
You can also try the above method, if the number of records is limited.
Following code works on 9.1 M40
Versioned reviseObj(final Versioned versioned){
Versioned newVersioned = null;
try {
newVersioned = wt.vc.VersionControlHelper.service.newVersion(versioned);
wt.fc.PersistenceHelper.manager.store(newVersioned);
} catch (WTPropertyVetoException e) {
e.printStackTrace();
} catch (WTException e) {
e.printStackTrace();
}
return newVersioned;
}