How to differentiate attached file depends on Revision

Hi, I have a document, which is in revision B, Now I want to differentiate files which are attached when a document is in Revision A and in Revision B. I try to visible created_on property which is on "Document File" relationship ItemType so that I can differentiate them with the help of date but when I attach a new file to the document, the created_on value of all documents get the current date and time.   Regards, Maddy.
  • Hi Maddy, When a parent item is versioned, new relationship items are created to link the parent item with its related items. That's why the created_on date of a versioned item's relationships may match the parent item's created_on date - even if the related items were added to a previous version. The following diagram shows how this works with the Part BOM relationship:  You can see that v1 of the Part has a relationship to Part 023. When v2 of the parent Part is created, a new Part BOM relationship is added so both v1 and v2 of the parent Part can reference Part 023. Regarding your use case, there are a few options. If you want the relationship grid to show which version of the parent item was originally linked to the related item, you can use a custom field and OnInsertRow grid event. The following sample code will get the major rev and generation of the parent item and set it on the relationship's custom field. Whenever the parent is versioned, the value will be copied to the new relationship item.
    var parentItem = parent.thisItem;
    var linked_version = parentItem.getProperty("major_rev","") + "." + parentItem.getProperty("generation","");
    setRelationshipProperty(relationshipID, <custom property name>, linked_version);
    Note that this approach will not set a value for related items added via code - only items added via the Innovator web client. It would be possible to implement the same behavior via server events, but it's not as easy. If users just need to find the earliest version of a parent item but it doesn't need to be displayed in the grid, they can use the where used dialog. Just right click on the related item in the grid and select View <Related ItemType>. When the related item opens, select Views > Where Used from the main menu. The resulting view will show any items that are related to the current item - including the versions of the parent items. Hope this helps! Eli
    Eli Donahue Aras Labs Software Engineer
  • Thank you Eli for a reply. I will try the first approach which you have shared i.e try to add a version of the parent item.   Regards, Maddy.