<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: I want to retrieve the part attribute in Windchill Customization</title>
    <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/I-want-to-retrieve-the-part-attribute/m-p/972518#M8716</link>
    <description>&lt;P&gt;Give it a try this way&lt;/P&gt;&lt;LI-CODE lang="java"&gt;				try {
					
					QuerySpec qs = new QuerySpec(WTChangeOrder2.class);
					
					SearchCondition searchcondition = new SearchCondition(WTChangeOrder2.class, WTChangeOrder2.NUMBER, SearchCondition.EQUAL, "CN0007698");
					

					qs.appendWhere(searchcondition, new int[]{0});
					final QueryResult qr = PersistenceHelper.manager.find(qs);
					while (qr.hasMoreElements()) {
						WTChangeOrder2 ecn = (WTChangeOrder2) qr.nextElement();
						System.out.println(" Found Change Order Number: " + ecn.getNumber());
						
						ReferenceFactory rf = new ReferenceFactory();
						WTReference reference = (WTReference) rf.getReference(ecn);
						WTChangeOrder2 changeNotice = (WTChangeOrder2) reference.getObject();
						QueryResult qr2 = wt.change2.ChangeHelper2.service.getChangeablesAfter(changeNotice, false);
						

						while (qr2.hasMoreElements()) {
							ChangeRecord2 record = (ChangeRecord2) qr2.nextElement();
							Changeable2 changeable = record.getChangeable2();
							System.out.println("Branch :" + changeable.getBranchIdentifier());

							ReferenceFactory rf2 = new ReferenceFactory();
							WTReference changeablereference = (WTReference) rf2.getReference(changeable);
							
							if (changeable instanceof WTPart) {
								
								System.out.println("WTPartMaster is found");
								WTPart part = (WTPart) changeablereference.getObject();

								PersistableAdapter obj = new PersistableAdapter(part, null, java.util.Locale.US, new com.ptc.core.meta.common.DisplayOperationIdentifier());
								obj.load("MaterialSpec");

								String MaterialSpecValue = (java.lang.String) obj.get("MaterialSpec");
								
								System.out.println("MaterialSpec: " + MaterialSpecValue);

								if (MaterialSpecValue != null) {
									System.out.println("MaterialSpec: " + MaterialSpecValue);
								} else {
									System.out.println("Material Spec is null");
								}
							}
						}
					}
				}
				catch(Exception exception) {
					exception.printStackTrace();
				}&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 19 Sep 2024 14:29:34 GMT</pubDate>
    <dc:creator>rhart</dc:creator>
    <dc:date>2024-09-19T14:29:34Z</dc:date>
    <item>
      <title>I want to retrieve the part attribute</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/I-want-to-retrieve-the-part-attribute/m-p/971783#M8697</link>
      <description>&lt;P&gt;I have the change Notice Number. From the changenotice number get the changables after from the changables i want only part. From that part i want to retrieve the attribute "Material_Type".&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2024 08:48:49 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/I-want-to-retrieve-the-part-attribute/m-p/971783#M8697</guid>
      <dc:creator>RaikarRaghu</dc:creator>
      <dc:date>2024-09-17T08:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: I want to retrieve the part attribute</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/I-want-to-retrieve-the-part-attribute/m-p/971786#M8698</link>
      <description>&lt;P&gt;Are you looking for a mapping of an alias attribute, or do you need to retrieve it attribute via api, or some other way?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2024 08:58:21 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/I-want-to-retrieve-the-part-attribute/m-p/971786#M8698</guid>
      <dc:creator>rhart</dc:creator>
      <dc:date>2024-09-17T08:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: I want to retrieve the part attribute</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/I-want-to-retrieve-the-part-attribute/m-p/971982#M8705</link>
      <description>&lt;P&gt;No Alias attribute. I want to pass one attribute value to the sap, for that in my code&amp;nbsp; i am getting the change notice number in which the part is involved in the change notice. So i am having the change notice number, by using the Change notice number&amp;nbsp; i want to retrieve the part, after the&amp;nbsp; retrieving i want to retrieve the part attribute.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ReferenceFactory rf = new ReferenceFactory();&lt;BR /&gt;WTReference reference = (WTReference) rf.getReference(changeNumber);&lt;BR /&gt;WTChangeOrder2 changeNotice = (WTChangeOrder2) reference.getObject();&lt;BR /&gt;&lt;BR /&gt;QueryResult qr = wt.change2.ChangeHelper2.service.getChangeablesAfter(changeNotice, false);&lt;BR /&gt;System.out.println("After size: " + qr.size());&lt;BR /&gt;&lt;BR /&gt;while (qr.hasMoreElements()) {&lt;BR /&gt;ChangeRecord2 record = (ChangeRecord2) qr.nextElement();&lt;BR /&gt;Changeable2 changeable = record.getChangeable2();&lt;BR /&gt;Persistable objMaster = changeable.getMasterReference().getObject();&lt;BR /&gt;QueryResult qr1 = ConfigHelper.service.filteredIterationsOf(objMaster, new LatestConfigSpec());&lt;BR /&gt;if (objMaster instanceof WTPart) {&lt;BR /&gt;WTPart part = (WTPart) objMaster;&lt;BR /&gt;&lt;BR /&gt;// Assuming that PersistableAdapter's constructor takes these parameters&lt;BR /&gt;PersistableAdapter adapter = new PersistableAdapter(part, null, SessionHelper.getLocale(), null);&lt;BR /&gt;adapter.load("MATERIAL_TYPE");&lt;BR /&gt;&lt;BR /&gt;Object materialTypeValue = adapter.get("MATERIAL_TYPE");&lt;BR /&gt;System.out.println("MaterialTypeValue: " + materialTypeValue);&lt;BR /&gt;&lt;BR /&gt;if (materialTypeValue != null) {&lt;BR /&gt;materialType = materialTypeValue.toString();&lt;BR /&gt;System.out.println("Material Type: " + materialType);&lt;BR /&gt;} else {&lt;BR /&gt;System.out.println("Material Type is null");&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2024 05:16:05 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/I-want-to-retrieve-the-part-attribute/m-p/971982#M8705</guid>
      <dc:creator>RaikarRaghu</dc:creator>
      <dc:date>2024-09-18T05:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: I want to retrieve the part attribute</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/I-want-to-retrieve-the-part-attribute/m-p/972518#M8716</link>
      <description>&lt;P&gt;Give it a try this way&lt;/P&gt;&lt;LI-CODE lang="java"&gt;				try {
					
					QuerySpec qs = new QuerySpec(WTChangeOrder2.class);
					
					SearchCondition searchcondition = new SearchCondition(WTChangeOrder2.class, WTChangeOrder2.NUMBER, SearchCondition.EQUAL, "CN0007698");
					

					qs.appendWhere(searchcondition, new int[]{0});
					final QueryResult qr = PersistenceHelper.manager.find(qs);
					while (qr.hasMoreElements()) {
						WTChangeOrder2 ecn = (WTChangeOrder2) qr.nextElement();
						System.out.println(" Found Change Order Number: " + ecn.getNumber());
						
						ReferenceFactory rf = new ReferenceFactory();
						WTReference reference = (WTReference) rf.getReference(ecn);
						WTChangeOrder2 changeNotice = (WTChangeOrder2) reference.getObject();
						QueryResult qr2 = wt.change2.ChangeHelper2.service.getChangeablesAfter(changeNotice, false);
						

						while (qr2.hasMoreElements()) {
							ChangeRecord2 record = (ChangeRecord2) qr2.nextElement();
							Changeable2 changeable = record.getChangeable2();
							System.out.println("Branch :" + changeable.getBranchIdentifier());

							ReferenceFactory rf2 = new ReferenceFactory();
							WTReference changeablereference = (WTReference) rf2.getReference(changeable);
							
							if (changeable instanceof WTPart) {
								
								System.out.println("WTPartMaster is found");
								WTPart part = (WTPart) changeablereference.getObject();

								PersistableAdapter obj = new PersistableAdapter(part, null, java.util.Locale.US, new com.ptc.core.meta.common.DisplayOperationIdentifier());
								obj.load("MaterialSpec");

								String MaterialSpecValue = (java.lang.String) obj.get("MaterialSpec");
								
								System.out.println("MaterialSpec: " + MaterialSpecValue);

								if (MaterialSpecValue != null) {
									System.out.println("MaterialSpec: " + MaterialSpecValue);
								} else {
									System.out.println("Material Spec is null");
								}
							}
						}
					}
				}
				catch(Exception exception) {
					exception.printStackTrace();
				}&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 19 Sep 2024 14:29:34 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/I-want-to-retrieve-the-part-attribute/m-p/972518#M8716</guid>
      <dc:creator>rhart</dc:creator>
      <dc:date>2024-09-19T14:29:34Z</dc:date>
    </item>
  </channel>
</rss>

