cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Please explain the role of EPMVariantLink

hsha1102
10-Marble

Please explain the role of EPMVariantLink

Hello,

 

I want to know the use of EPMVariantLink and in which scenario should we use it ?

In my team they are using the below API to fetch the EPMDocument and then fetching the EPMDocumentMaster. Why can't I use the below mentioned alternate way, please explain the difference between them.

 

As-Is logic:

private static EPMDocumentMaster getParentsByEPM(List<EPMDocument> parentsrList, EPMDocument instanceEpm)throws WTException{

       parentsrList.add(instanceEpm);
       QueryResult ft_qr2 = EPMStructureHelper.service.navigateGenericToIteration( instanceEpm, null, true, null);
       if(ft_qr2 != null && ft_qr2.size() > 0) {
             while(ft_qr2.hasMoreElements()) {
                    EPMDocument epm = (EPMDocument) ft_qr2.nextElement();
                    parentsrList.add(epm);
                    getParentsByEPM(parentsrList, epm);
              }
        }

         return (EPMDocumentMaster)parentsrList.get(parentsrList.size() - 1).getMaster();
}

 

Alternative Way:

      EPMDocumentMaster testMaster=(EPMDocumentMaster) instanceEpm.getMaster();

 

Thanks and Regards,

Hari R

3 REPLIES 3
hlafkir
13-Aquamarine
(To:hsha1102)

HI Hari,

 

Please take a look in this article :

https://www.ptc.com/en/support/article/CS256815 where you will see in what case it is helpful to use the EPMVariantLink to navigate into a family table.

 

Check also your database to see how behave the relationship between EPMDocument, EPMMaster and EPMVariantLink.

 

there is an excellent class diagram at this link :

 

wt.epm

 

VairantDiagramme.PNG

 

Are you getting the same results from the method and you alternate way ?

 

Hicham

Hello @d_graham ,

 

Thank you for your response. I will check the article you have mentioned.

 

To answer your question, yes both the ways are giving me the same output.

 

Regards,

Hari R

d_graham
17-Peridot
(To:hsha1102)

If all you want to do is get the EPMDocumentMaster from its EPMDocument your alternate way is fine but you haven't given us any context.  What exactly are you trying to do?

 

The code you sent is a loop (that keeps calling the original method) where you keep adding to a list of generic iterations and ultimately return the EPMDocumentMaster of the last EPMDocument generic added to the list.

 

The EPMVariantLink is a link that links generic's EPMDocumentMaster to its instance's EPMDocument.

Top Tags