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

DEVELOPERS FORUM - Showing reverse relationship

Jeroen Bosch - Friday, June 27, 2014 11:24 AM:

Hi all,

I am sorry if this question has been already answered but before posting I have made unfruitful research in this forum.

I am looking for a way to show a "reverse relationship".

For example:

Let's say I have two item types Person and Car.

I have also a relationship "Person owns car" defined in the Person item type.

In the Person form, I can add/create Car(s) .

I want to be able to show/add/create Person(s) in the Car item type form.

Thank you for your help.

Jeroen

 

 

 



DavidSpackman - Friday, June 27, 2014 8:36 PM:

Is this what you are after?

blog.minerva-plm.com/.../

 



Jeroen Bosch - Saturday, June 28, 2014 5:20 AM:

Thanks David.

The example is trying to solve similar needs but not totally what I am after.

I need:

1) to manage a many to many relationship while the example was developed for a one to many (one project has one customer; one customer may have many projects)

2) to be able to pick/create the related object from either side of the relationship

For point 2, it might be that Yoann published a solution as he wrote "I will show soon how to implement the same reverse relationship with a normal Relationship Type.". I will do some research in that excellent blog.

Jeroen

 



DavidSpackman - Monday, June 30, 2014 7:29 PM:

Hi Jeroen,


This currently isn't possible out of the box with Aras.

I had been trying to create a tool to allow users to create the reverse relationship.

 

An early release can be found at the link below, but it is more a proof of concept and there isn't any documentation on it,

https://github.com/DavidSpackman/ArasRelationshipWizard/

Couple of releases here:

https://github.com/DavidSpackman/ArasRelationshipWizard/releases/

 

Dave



Jeroen Bosch - Wednesday, July 2, 2014 10:25 AM:

Hi David,

Seems to me that Aras developers should have look into implementing this reverse relationship as a core Aras feature.

I'd like to give a try to your tool but I would need a couple of lines of description how to install and use it.

Many thanks.

Jeroen



DavidSpackman - Thursday, July 3, 2014 11:05 PM:

Hi Jeroen, 

I need a little time to create an instruction.

Should work on both 9.3 and 9.4. Have not tested in version 10

Basically you need to follow these steps

 

  • Download the latest release from releases page (https://github.com/DavidSpackman/ArasRelationshipWizard/releases)
  • Install the Aras packages in the /packages folder (Using Type = Merge and Mode = Through Mode)
    • 1st install 1- Import - Reverse Relationship Wizard
    • 2nd install 2- Import- Example on Document (opt)
  • Now, when you open a document open there should be a button to create a reverse relationship. When you click on that it will open the form wizard I created

 

See how you go and let me know if you have any questions.

 

 



Jeroen Bosch - Sunday, July 13, 2014 2:39 PM:

Hi David,

I have uploaded your first package but didn't find the time to test it yet.

I have also found this technical note:

www.aras.com/.../How to create reverse relationship views KB-000101.pdf

How does your implementation differ from the one in the technical note?

Regards,

Jeroen



DavidSpackman - Sunday, July 13, 2014 11:03 PM:

Hi Joroen,

 

The note you sent shows how to create a read only view of the reverse relationship. (By the way, that technical note has been superseded by the method in the video I linked to)

The Aras client currently only allows you to create relationships from the source item. This means that if you had 1 document related to many parts, you need to create the relationship in each relevant part record (very time consuming).

 

If you look at the relationship Itemtype you will see each record has a source Itemtype and related Itemtype. i.e. In the Part Document Relationship the Part is the source Itemtype and the Document is the related Itemtype.

 

The tool I created works differently from the Aras client behaviour,

 

  • It is made to be ran from the related item (i.e. Document). 
  • It allows the user to find all relationships that can be created with that item as the related Itemtype. 
    • Part Document
  • It allows you to choose your desired relationship (i.e. Part Document) and browse the source items (i.e. Parts) that require that relationship to be created between the the source item (Parts you added to the grid) and the related item (Document you ran the tool from)

 

The idea was to help users save time by creating the relationships from the related Itemtype, not the source Itemtype.

 

Here is a screenshot from the tool that may help explain,

  • This was ran from a Document with the keyed_name D000001.
  • In this database, there are two possible relationships with the Document Itemtype, Part Document and AM Project Document.
  • When I choose Part Document, and press the Choose Items button, I can use the standard Aras browser to add items to the grid.
  • Once ready I can choose to create the relationships with the button to the right above the grid.


 

Dave



zahar - Monday, July 14, 2014 2:21 AM:

David,

It look very good idea. 

Don't forget address permission issues, like: Adding 'child' item to bom of parent can't be added for "Released" 'parent' item. And there is more like this. 
There is setting on itemtype of relationship that enforce access control based on source_id item "Use Src Access"



Jeroen Bosch - Monday, July 14, 2014 5:39 AM:

David,

I like your approach and will look in more depth to your configuration as soon as possible.

By the way, in my version of Aras (10.0 build 5846), I am not able to find "Grids" in the Administration menu. I have asked the question to support and waiting for their reply.

Jeroen



DavidSpackman - Monday, July 14, 2014 5:29 AM:

HI Zahar,

 

I haven't done in depth testing of these use cases.

I am only using AML to get the source items and create the relationships. The system will prevent get/add for users that do not have permission do to so.

(The relationship creation is done on the server, and it possible to apply the relationship as Aras PLM. I had some use cases I wanted to test being able to override default user permission)


Dave



DavidSpackman - Monday, July 14, 2014 7:02 AM:

Version 10.0 of Aras doesn't support grids. I think one of the service packs introduces support for them.



zahar - Monday, July 14, 2014 7:02 AM:

Dave,

It dependce what type ofAML you are writing.

When you creating/updating the relationship itself, it will be updated or created even if the source item is released. 

To make sure you update the relationship with source permission you need to use aml that actually updates the source and create or update it's relationships.

 

As i writing this comment, i have.realize that you must use AML that editing the parent because there can be issues with Configuration managment. For example if parent rev. Managment is Auto need to create new generation each time you chage it's relationships. Or if part is Released you must create new major rev and move the part to preliminary when u changing the relationships.

 

So be carreful whem you creating your solution, there is.more in PLM than.just link 2 objects

 



Jeroen Bosch - Monday, July 14, 2014 2:43 PM:

So I need a subscription to be able to build grids !?

So strange, as Grids used to be available in Aras 9.x community version.



DavidSpackman - Monday, July 14, 2014 7:21 AM:

HI Zahar, 

 

I understand what you mean, the tools always creates the relationship from the part item.

For example when creating a Part Document Relationship the tool creates an AML query that look something like

---------------------------------------------

<AML>

<Item type="Part" action="edit" id="SourceItemID">

<Relationships>

<Item type="Part Document" action="add">

<related_id>RelatedItemID</related_id>

</Item>

</Relationships>

</Item>

</AML>

---------------------------------------------

If the users doesn't have the correct permission of the source item, Aras will return an access denied error message to the user (which I catch and display)

 

I have added options to set the 'version' attribute to 0 or 1 to handle creation of generation. The tool was only created to consider cases where Aras will automatically version the item if you edit it in a released state.

 

If you have a chance to use the tool, let me know if you find any issues with it, or other general feedback.


Cheers.