Ron - Monday, March 26, 2007 3:48 PM:
I have been testing Innovator CM process and noticed that neither part nor Documents shows the CN status of a item in the normal TOC view.
Is there a way to show if a part or doc is under review by either a ECR or ECN process? I would expect this to be a standard requirment, ie to know at a glance if an item is under review.
Thanks for you replys
SamsAn - Tuesday, March 27, 2007 8:11 AM:
Hi.
Seems the steps below may be helpful to configure the required behavior.
1. Login as admin, select AdministrationItemTypes in TOC, edit Part (for example) ItemType.
-> New window appears.
2. Select Properties tab in the window, add new property there (name=ecn_process, data_type=Federated)
3. Go to Server Events tab in the window, add new event (onAfterGet) with the method (type=VB) having the following code:
Dim tmpInn As Innovator = Me.newInnovator()
Dim q As Item = tmpInn.newItem("tmp", "tmp")
Dim x As String
Dim itm As Item
Dim i As Integer
For i=0 To Me.getItemCount()-1
itm = Me.getItemByIndex(i)
x = String.Format("" + _
"<Item type='ECN Affected Item' action='get' select='source_id'>" + _
" <related_id>" + _
" <Item type='Affected Item' action='get'>" + _
" <affected_id>{0}</affected_id>" + _
" </Item>" + _
" </related_id>" + _
"</Item>", itm.getAttribute("id"))
q.loadAML(x)
q = q.apply()
If q.getItemCount()>0 Then
q = q.getItemByIndex(0)
itm.SetProperty("ecn_process", q.getPropertyAttribute("source_id", "keyed_name"))
End If
Next i
4. Test the behavior: select DesignParts in TOC, click Run Search icon (result: ECN Process column is populated by the corresponding ECN number). Seems this behavior is required.
Note 1: you can modify Part form and add a field for ecn_process federated property to view the ECN number on the form.
Note 2: the same way may be used for Document items to configure an analogous behavior.
Ron - Tuesday, June 26, 2007 9:47 AM:
Hi Andrey
I finally had some time to test this approach, it does display ECN number, but it does not display the most recent ECN also is it possible to see only the active ECN?
Thanks
Ron
SamsAn - Tuesday, June 26, 2007 10:42 AM:
Hi, Ron.
The following method modification may be used to get ECN with state=Active
Dim tmpInn As Innovator = Me.newInnovator()
Dim q As Item = tmpInn.newItem("tmp", "tmp")
Dim x As String
Dim itm As Item
Dim i As Integer
For i=0 To Me.getItemCount()-1
itm = Me.getItemByIndex(i)
x = String.Format("" + _
"<Item type='ECN Affected Item' action='get' select='source_id'>" + _
"<source_id condition='in'>(SELECT id FROM [ECN] WHERE state='Active')</source_id>" + _
" <related_id>" + _
" <Item type='Affected Item' action='get'>" + _
" <affected_id>{0}</affected_id>" + _
" </Item>" + _
" </related_id>" + _
"</Item>", itm.getAttribute("id"))
q.loadAML(x)
q = q.apply()
If q.getItemCount()>0 Then
q = q.getItemByIndex(0)
itm.SetProperty("ecn_process", q.getPropertyAttribute("source_id", "keyed_name"))
End If
Next i
The following method modification may be used to get the most recent ECN with state=Active for every part received.
Dim tmpInn As Innovator = Me.newInnovator()
Dim q As Item = tmpInn.newItem("tmp", "tmp")
Dim x As String
Dim itm As Item
Dim i As Integer
For i=0 To Me.getItemCount()-1
itm = Me.getItemByIndex(i)
x = String.Format("" + _
"<Item type='ECN Affected Item' action='get' select='source_id'>" + _
"<source_id condition='in'>(SELECT TOP 1 id FROM [ECN] WHERE id in (SELECT source_id FROM [ECN_Affected_Item] WHERE related_id IN (SELECT id FROM [Affected_Item] WHERE affected_id='{0}')) AND state='Active' ORDER BY created_on DESC)</source_id>" + _
"</Item>", itm.getAttribute("id"))
q.loadAML(x)
q = q.apply()
If q.getItemCount()>0 Then
q = q.getItemByIndex(0)
itm.SetProperty("ecn_process", q.getPropertyAttribute("source_id", "keyed_name"))
End If
Next i
NOTE: of course, direct sql (it's better because of performance) may be used to select the ecn numbers, but it is more correctly to use AML (because of permissions, etc.).
I hope it helps
Andrey
Ron - Tuesday, June 26, 2007 11:25 AM:
Thanks Andrey
I modified your code for the most recent to change from 'Active' state to check for either 'In Work' or 'In Review' state.
"<source_id condition='in'>(SELECT TOP 1 id FROM [ECN] WHERE id in (SELECT source_id FROM [ECN_Affected_Item] WHERE related_id IN (SELECT id FROM [Affected_Item] WHERE affected_id='{0}')) AND (state='In Review' or state='in work') ORDER BY created_on DESC)</source_id>" + _
This works great.
Thanks for your help.
Note to development team; This would be a good enhancement for Innovator Core.
Ron
Ron - Tuesday, June 26, 2007 11:52 AM:
Better yet, I modified the code to look for the standard three states 'In Planning, In Work and In Review'. plus I saved this method as ECR_Process and modified it to look at the ECR states, add this new method to server events. Now when viewing the search results for parts any ECR or ECN which is pending is displayed in the same column.
Works Great.
Ron