Start a new topic
Answered

Item type name from SID

Is there a way in the API to get the item/part type name from an SID?


An example: 

In the meta model, I have the item types "myItem" and "mySubItem" with their respective SIDs. The second item is a part of the first one with SID "PSID". I use the API to get the parts of an instance "item1" of the item "myItem", which gives me a list of items "mySubItem". In case "item1" does not yet have any parts with "PSID", I get an empty list, which is fine. In that case, I display an error message saying "The item 'item1' does not yet have any parts with SID 'PSID'". However, it would be much more readable if the message said "The item 'item1' does not yet have any parts of type 'mySubItem'".


How can I get the item type name (or the part type name) from the part SID?


Best Answer

Hello! 


The following will return the item and part type name from a SID. 


IswItemType itemType = SWConnection.Instance.Broker.swItemType("I");
string itemTypeName = itemType.Name;

IswPartType partType = SWConnection.Instance.Broker.swPartType("IDR");
string partTypeName = partType.Name;


Best regards, 

1 Comment

Answer

Hello! 


The following will return the item and part type name from a SID. 


IswItemType itemType = SWConnection.Instance.Broker.swItemType("I");
string itemTypeName = itemType.Name;

IswPartType partType = SWConnection.Instance.Broker.swPartType("IDR");
string partTypeName = partType.Name;


Best regards, 

Login to post a comment