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

We are happy to announce the new Windchill Customization board! Learn more.

Customize CreateMultiplePart wizard

vlmadala
9-Granite

Customize CreateMultiplePart wizard

I am trying to add Custom Attribute to CreateMultiplePart Wizard . This attribute is a picker . Based on the selected Type of WTPart Part , it should populate the Attribute "Parent Part" , where User should be able to search the parent part Name  . 

CreateMultiplePart Wiz 's defineItem.jspf page controls the wiz definition . Any changes there , also gets applied to CreateNewPart wiz. Please suggest a right approach .

 

1 ACCEPTED SOLUTION

Accepted Solutions

What have I done >D

I did a mistake 

 

in suggestion helper, the arrayList is defined not well.

The collation items have to be a SuggestResult type  

 

so 

	public Collection<SuggestResult> getSuggestions(SuggestParms suggestParams)
	{
		ArrayList suggestList = new ArrayList();
		String searchKey = suggestParams.getSearchTerm().toUpperCase();

		suggestList.addAll(getResultsByKey(searchKey));
		
		String numberStr = "searched key"; // a result what is returned
		SuggestResult sugestItem = SuggestResult.valueOf(numberStr);
		suggestList.add(sugestItem);
		
		return suggestList;
	}

HelesicPetr_0-1663923185457.png

 

PetrH

View solution in original post

9 REPLIES 9
avillanueva
22-Sapphire I
(To:vlmadala)

You should be able to customize the table to display custom IBA attributes, assuming the attribute you are referring to be a String attribute. It would be displayed as a free text field with any constraints you might have. You can add attributes to a custom table view. I do have to step back and question if what you are asking is correct. What do you mean by Parent Part? Is this a next higher assembly? As far as I know, there would be customization involved if you wanted that attribute to be rendered as a search field and look for other parts. There may be other ways to handle your requirement other than with an IBA attribute. 

avillanueva_0-1663786975134.png

 

Hi @avillanueva,

I guess that @vlmadala would like to show a dynamic enumeration list based on the parent WTPart.

 

He has to clarify that.

 

I have just one idea how to achieve it for now. From my point of view the easiest way is. use own IBA with custom DataUtility.

DataUtility will care to show dynamic list

If part goes to hundred and hundred assemblies there is a risk with performance, 

 

PetrH

Right, it should not be implemented as a drop down list but rather a search/pick interface. But I still have questions on the use case. If we take "parent" to mean next higher assembly, they carrying an attribute which displays that is not a good idea even if its a top level end item. It should be dynamically looked up by navigating the BOM. Parents can change at any time.

I have Used the IBA with Custom Data Utility .  Here are the approaches I took .
1. Create a new Wizard step as step 2 in Create Multiple Part Wizard . This 2nd Wizard page should contain the required Attribute.

Challenges :

1. My WTPart Part has 5 items in Typed  List . The Wizard 2 should appear only when type is selected as 03-Part .

2. Here Wizard step 2 appears for all the types irrespective of what you select from drop down .

3. How do I implement the Set attribute wiz step which will prepopulate the attribute values based on the Selections made

 

 

Approach-2 : 

Trying to add the attributes( Picker ad dropdown ) on the defineItem page (wiz-step 1)  , that should be available to user  when Type is picked as 03-WTPart  . For rest of the parts it should behave OOTB  . 

Here the challenge is to inherit the behaviour for driverAttribute , Not able to achieve the condition . I've created a custom jsp for defineItem page .(netmarkets/jsp/component/defineItem.jspf ) .  Should I have write a js call back  ? still not able to show the attribute dependency with Type selection.

Please suggest how I can achieve this . 

The Attribute I want to implement are Text Box with picker   & a dropdown .

@vlmadala 

Just clarify: two different attributes

 

1. the Textbox with picker (search picker)

HelesicPetr_1-1663852289683.png

 

2. the DropDown list 

HelesicPetr_0-1663852202531.png

 

(the pictures are just examples not a real custom implementation 😄 )

 

PetrH

Yes.. I have 2 Attributes  .. A Text Box which has a search capability ( also allows to type in the Part Name . second is a drop down . 🙂😄  Due to Confidentiality reasons , I can post the snapshots of what I have implemented yet . 😑

Hi @vlmadala 

Text box with a suggestion search 

Create DataUtility with SuggestTextBox object and return it. 

The serviceAVENGSuggestionHelper is a service selector that search what you need. It is an another class and added to a service.properties as a service.

 

datautility example:

 

 SuggestTextBox suggest = new SuggestTextBox(component_id, "serviceAVENGSuggestionHelper");
 suggest.setLabel(component_id);
 suggest.setId(component_id);
 suggest.setName(component_id + "_col_" + component_id);
 suggest.setColumnName("Order Number");
 suggest.setMinChars(2);
 suggest.setRequired(true);
 suggest.setMaxResults(50);
 suggest.setMaxLength(40);
 suggest.setEnabled(true);
 suggest.setEditable(true);
 suggest.setMaxLength(12);
 suggest.setWidth(40);

 if (modelContext.getDescriptorMode() == ComponentMode.EDIT || modelContext.getDescriptorMode() == ComponentMode.CREATE)
 {
  suggest.setValue("");
 } else
 {
  suggest.setValue(suggest.getParm((String) component_id));
 }

 return suggest;
}

 

 

 Service example

 

public class AVENGSuggestionHelper implements Suggestable
{
 String[] store = new String[]{"Ryan Alberts", "Mike Robinet", "Jeff Wehrman", "Tanya Yourchuck", "John Smith", "Joe Smith", "Bob Smith", "Mike Smith", "Juan Carlos", "Jane Smith", "Mike Jones", "David Smith ", "Sarah Smith ", "James Smith ", "Paul Smith ", "Mario Rossi ", "Steve Smith ", "Mark Smith ", "Chris Smith ", "Juan Perez ", "Michael Smith ", "Jason Smith ", "John Johnson ", "Lisa Smith ", "Dave Smith ", "Jose Luis ", "David Jones ", "John Jones ", "Mary Smith ", "Ahmed Ali ", "Bob Jones ", "Tom Jones ", "Miguel Angel ", "Chris Jones ", "Jim Smith ", "Robert Smith ", "Tom Smith ", "Sarah Jones ", "Jennifer Smith ", "Billy Bob ", "Mohamed Ahmed ", "Jessica Smith ", "Bill Smith ", "John Williams ", "Ali Veli ", "Ana Maria ", "Chris Brown ", "Ahmed Mohamed ", "Juan Pablo ", "Mohamed Ali ", "Kevin Smith ", "Sam Smith ", "Jon Smith ", "James Brown ", "Michelle Smith ", "John Brown ", "Marco Rossi ", "Chris Johnson ", "Brian Smith ", "Jack Smith ", "Mike Johnson ", "Kelly Smith ", "Mark Jones ", "Carlos Rodriguez ", "Jim Jones ", "Imran Khan ", "Peter Smith ", "Jose Perez ", "David Johnson ", "Karen Smith ", "Jose Rodriguez ", "Andrew Smith ", "Adam Smith ", "Steve Jones ", "Hakki Yildirim ", "Maria Lopez ", "David Brown ", "Matt Smith ", "Amy Smith ", "John Lee ", "Michael Johnson ", "Susan Smith ", "Carlos Garcia ", "Jose Garcia ", "Paul Jones ", "Carlos Perez ", "Mark Johnson ", "David Williams ", "Amanda Smith ", "David Lee ", "James Jones ", "Ashley Smith ", "Maria Jose ", "Ryan Smith ", "Ali Khan ", "Tim Smith ", "Carlos Gonzalez ", "Jeff Smith ", "Jose Lopez ", "Richard Smith ", "Michael Jones ", "Julie Smith ", "Dan Smith ", "Carlos Martinez "};

 public AVENGSuggestionHelper()
 {
 }

 public Collection<SuggestResult> getSuggestions(SuggestParms suggestParams)
 {
// you can do what you need to search here. 
  ArrayList suggestList = new ArrayList(List.of(store));

 return suggestList; // return colletion
 }
}

 

set xconf.properties

 

 <Service context="default" name="com.ptc.core.components.suggest.Suggestable"
 targetFile="codebase/service.properties">
 <Option cardinality="duplicate" order="1" overridable="true"
 requestor="null"
 selector="serviceAVENGSuggestionHelper"
 serviceClass="cz.aveng.Example.AVENGSuggestionHelper"/>
 </Service>

 

 

DataUtility with ComboBox (the DropDown list )

 

@Override
public ComboBox getDataValue(String component_id, Object obj, ModelContext modelContext) throws WTException
{

 if (obj != null && obj instanceof WTPart)
 {
  WTPart wtp = (WTPart) obj;
  //create combobox
  ComboBox comboBox = new ComboBox();
  comboBox.setLabel(component_id);
  comboBox.setId(component_id);
  comboBox.setColumnName(AttributeDataUtilityHelper.getColumnName(component_id, obj, modelContext));
  ArrayList<String> enumerationsInter = new ArrayList<>();
  ArrayList<String> enumerationsDisplay = new ArrayList<>();
  enumerationsInter.add("MYINTERNALVALUE");
  enumerationsDisplay.add("My Display Value");

  comboBox.setInternalValues(enumerationsInter);
  comboBox.setValues(enumerationsDisplay);

  return comboBox;
 }
 return null;
}

 

 

PetrH

What have I done >D

I did a mistake 

 

in suggestion helper, the arrayList is defined not well.

The collation items have to be a SuggestResult type  

 

so 

	public Collection<SuggestResult> getSuggestions(SuggestParms suggestParams)
	{
		ArrayList suggestList = new ArrayList();
		String searchKey = suggestParams.getSearchTerm().toUpperCase();

		suggestList.addAll(getResultsByKey(searchKey));
		
		String numberStr = "searched key"; // a result what is returned
		SuggestResult sugestItem = SuggestResult.valueOf(numberStr);
		suggestList.add(sugestItem);
		
		return suggestList;
	}

HelesicPetr_0-1663923185457.png

 

PetrH

Top Tags