This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

APPLICATION - PRODUCT ENGINEERING - Revision Control Alpha vs Numeric

Ron - Tuesday, May 15, 2007 2:38 PM:

I would like to setup Innovator to allow for two different revision schemes;

For pre-released drawings/Documents we would like to have numeric revisions, for released drawings/Documents we need to use Alpha revision control.

Is it possible to assign two revision control schemes to the itemtype ? If not how can parts/Documents have the revision switched from Numeric to Alpha upon release?

Thanks

 Ron



SamsAn - Wednesday, May 16, 2007 4:30 AM:

Seems, it's impossible to assign two revision control schemes to the itemtype.

 I offer two solutions for your situations.

1.

If it's allowed to not store numeric major_rev in the database in your case. Use onAfterGet server event for Part/Document ItemType to populate major_rev property according to generation property value. I think it's the best solution.

2.

- Use Alpha revisions in Part/Document ItemType configuration.

- Use  the following method in onAfterAdd and onAfterVersion server events to set numeric revision in database for not released items:

'+++++++++++ Implemented for Document ItemType
Dim tmpInn As Innovator = Me.newInnovator()
Dim q As Item = tmpInn.newItem("Document", "get")
q.setAttribute("id", Me.getAttribute("id"))
q.setAttribute("select", "major_rev,state") 'to improve performance
q = q.apply()
If q.isError() OrElse q.getItemCount()<>1 Then Return q
q = q.getItemByIndex(0)
Dim state As String = q.getProperty("state")
Dim new_major_rev As String = ""
Dim i As Integer
Try
  i = CInt(q.getProperty("major_rev"))
Catch ex As Exception
  i = 0
End Try

'If i<>0 AndAlso state = "Released" Then new_major_rev = "A" 'to switch to Default Alpha revision
If IsNothing(state) OrElse state = "Preliminary" OrElse state = "In Review" Then new_major_rev = CStr(i+1) 'get next number in Numeric revision

If new_major_rev<>"" Then
  Dim conn As Aras.Server.Core.InnovatorDatabase = CCO.Variables.InnDatabase
  Dim sql As String = String.Format("UPDATE [DOCUMENT] SET major_rev='{0}' WHERE config_id=(select config_id from [Document] where id='{1}') AND new_version='1' ", new_major_rev, Me.getAttribute("id"))
  conn.ExecuteSQL(sql)
End If

'---------------- Implemented for Document ItemType

-  Use an analogous Pre Method for the transition to Released state in Document LifeCycleMap to reset the major_rev to 'A'.



RobMcAveney - Wednesday, May 16, 2007 11:25 AM:

There is an alternate solution that I've used before.  You can create a Revision sequence that has both numeric and alpha characters in it, like "1 2 3 4 5 6 7 8 9 A B C".  The item will use the numeric revisions by default, but when it gets released to production you can make it "jump ahead" in the revision sequence by running a method with code something like this:

Item myItem = this.newItem(this.GetType(),"edit");
myItem.setID(this.getID());
myItem.setAttribute("version","0");
myItem.setProperty("major_rev","A");
return myItem.apply();

Note the use of version="0", which prevents an additional version from being created by this operation.  Depending on your circumstances, this method could be run from the Life Cycle Map (maybe on the post-transition event on the transition to 'Released To Production') or as an Action.  Another thing to be sure of is that your Revision sequence has more numbers than you would ever use so that you don't accidentally end up with alpha revs when you don't want them.

Rob 



Ron - Wednesday, May 16, 2007 3:18 PM:

Thanks Rob, I like your idea. We currently use Numeric Revision to identify non-released documents/parts and this method should work for us.

 i will test this out and post my results later.

 

Thanks

Ron