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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Change revision by code

VasiliyRepecki
1-Newbie

Change revision by code

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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;

}

View solution in original post

2 REPLIES 2

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;

}

Top Tags