Poly ItemType - mapping properties of poly sources

Hi,

We have more and more needs to display tables with several different itemtypes in one place with all filtering features and of course the first thought is to use poly itemtype.

But here is the problem. Let say that we have 4 poly sources which all have similar property  but all with a different property name. 

We have a lot of custom code on these item types looking for properties with certain names. So renaming these properties is quite a pain...

Has anyone figured out how it would be possible to map these different properties into one poly item property. Maybi like SQL Select statement with AS or some server event like onAfterGet... (this.setProperty('name1',''), this.getProperty('name2','')).

If such a thing were possible, poly items would be much more useful.

How do you solve it?

Parents
  • Hi Jan,

    I personally would rename them, cause I like standardized naming of properties. But I understand the argument that you don´t want to touch too many Methods.
    I assume the way PolyItems are built is a core feature, so we probably cannot directly influence it.

    Some more technical approaches (not tested!!!):

    Poly-ItemTypes are not real physical ItemTypes/tables. They are just SQL Functions that do a UNION of the various tables.

    Idea #1: Change the function in SQL directly.... Ok, I am not sure if it´s possible at all. And of course it´s a modification that is overwritten all the time when you edit the ItemType. And it´s not visible for the Aras update team so if you don´t overwrite it, they definitely will. It´s not the best idea to be honest.

    Idea #2: Make a custom SQL view and link it to your target ItemType via "onGet" server Method. 

    These ideas shall not be seen as final answers. I am also interested in this question! One of design mistakes of the early days of innovator was the name/title inconsistency. Regular Items often use the "name" property, while everything related to CM use "title" as naming field. Building PolyItems with these kind of ItemTypes creates exactly the problem you described.

    Out of interest I made a quick SQL test by myself, and indeed a custom SQL call for the Poly could be used to link non-identical property names:

    SELECT TOP(10) item_number, name from innovator.Part
    UNION
    SELECT TOP(10) item_number, title from innovator.EXPRESS_ECO

    But as mentioned before, there are maybe better solutions out there. Maybe the "Morphae" ItemType contains some secrets that we haven´t discovered yet, not sure. There is also this TechTip which maybe helps: https://community.aras.com/b/english/posts/tech-tip-sync-a-poly-itemtype-s-properties-with-its-poly-sources

    Angela

  • Hi Angela,

    Thanks for quick answer. As you mentioned I was hoping on some secret way of achieve this :D

    Anyway I have an itemtype with onGet method implemented which call SQL stored procedure (to accept parameters for filtration) and it works.

    But... to cover all possible combination of filtration (like, not like, equal...) and all type of properties (string, date, list...) for every column takes a lot of work and nerves.

    I'm looking for more elegant way... with more configuration and less coding...

    Maybe Aras only need to implement some mapping logic between poly source properties (maybe also some conversion logic...) and poly itemtype would be way more useful.

  • Hi Jan,

    I agree, somekind of mapping logic would be the best solution. Even if you merge two or more ItemTypes inside an onBefore/AfterGet Method, it´s still would require a lot of coding.

    Do you use a custom onGet Method or the Aras Federation sample? 

    I remember I still have this open post in this forum: 

    community.aras.com/.../who-is-using-the-aras-sql-federation-itemtype-sample-v3-1-and-can-share-experience

    I use both version (custom and Aras) in parallel and both have their pros and cons. The Aras Federation sample contains a mapping ItemType so it´s faster to implement and doesn´t require custom code. But query speed is higher with the custom variant.

Reply Children
No Data