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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Which API I can use to identify WTPartMaster object type

Vaibhav_Thakare
5-Regular Member

Which API I can use to identify WTPartMaster object type

Working on customization task, need to call Part Master object type so for that i need WTPartMaster API.

see attached screenshot for the reference.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Vaibhav_Thakare 

It is very simple

if (object instanceof WTPartMaster)// for your case ignore this object. 
{
  WTPartMaster wtpm = (WTPartMaster) object;
}

You don't need any WTPartMaster API  

 

PetrH

View solution in original post

6 REPLIES 6

Hi @Vaibhav_Thakare 

What do you need?

Just use if instance of WTPartMaster and retype the object to the WTPartMaster object.

Thenn you can work with Master as you need. getNumber and so on

 

Usually if you see master in the structure, it means that the object does not meet filter criteria or the user does not have a access to that object.

 

Structure filter has a option (check box) to do not show master objects where the filter is not met. 

 

PetrH

Need WTPartMaster API which will help to identify WTPartMaster component/items in BOM, so i can exclude those items from our customized BOM report.

Hi @Vaibhav_Thakare 

It is very simple

if (object instanceof WTPartMaster)// for your case ignore this object. 
{
  WTPartMaster wtpm = (WTPartMaster) object;
}

You don't need any WTPartMaster API  

 

PetrH

🤝🤝Thank you

Hi PetrH,

You mean this way only right by considering object as "WTpart"

 

boolean isPartMaster = isPartMaster(part);

public static boolean isPartMaster(WTObject object) throws WTException {

        if (object instanceof WTPart) {

            WTPart part = (WTPart) object;

            WTPartMaster master = part.getMaster();

            

            return master != null && master.equals(part);

        }

        return false;

    }

Hi @Vaibhav_Thakare 

You can not use equal test between two different java types that are not connected. 

master.equals(part); can not be used or yes you can but you never ever get true return.

WTPartMaster object is not same as WTPart object. 

function part.getMaster(); returns always WTPartMaster... from WTPart

 

It is like you compare a personal car to a track

 

If you need check if the object is WTPartMaster then use code I've provided. 

 

public static boolean isPartMaster(WTObject object) throws WTException 
{
if (object instanceof WTPartMaster)
  {
    return true;
  }
return false;
}

 

PetrH

Top Tags