Three free tickets to Procurement & Supply Chain LIVE: Chicago. First come first served. Contact Dave Duncan at dduncan@ptc.com.
I am using Windchill PDMLink Release 12.1 and Datecode with CPS 12.1.2.8
I have a 3 Multiple Wizards a on a custom action , in each wizard page I have a different MVC table on which I'm rendering data using Custom Bean object . When I'm submitting the wizard form , I want to get the rows selected in the MVC table in 3rd wizard page in Formprocessor. I'm not getting the values using nmcommandbean object . Please help me if there is any other way to get these values.
Solved! Go to Solution.
Hello Charles,
I managed to get the data what I need in Oid String . My problem got resolved . Thank you so much for your help.
I have extended the NmObject to my custom Bean created a URL encoded Json Object and setting that as Oid. In the Json object I have input all the needed data. Below is the code I used. I got the values in formprocessor using getNmOidSelected().
public class customBean extends NmObject {
String partNumber;
String partName;
String partState;
String locationName;
String clientNumber;
String plantNumber;
boolean nonSelectableRow;
public customBean () {
}
public customBean (WTPart selectedPart, WTPart selectedDownStreamSystem, boolean updateFlag,String traType)
{
updateNmOid(selectedPart, selectedDownStreamSystem, updateFlag,traType);
}
private void updateNmOid(WTPart selectedPart, WTPart selectedDownStreamSystem,String traType)
{
NmSimpleOid simpleOid = new NmSimpleOid();
JSONObject joNmOid = new JSONObject();
try {
joNmOid.put("selectedPartOid", selectedPart.getPersistInfo().getObjectIdentifier().toString());
joNmOid.put("selectedDssOid", selectedDownStreamSystem.getPersistInfo().getObjectIdentifier().toString());
joNmOid.put("updateFlag", updateFlag);
joNmOid.put("transferType", traType);
String encodedBeanKey = Base64.encodeBase64URLSafeString(joNmOid.toString().getBytes());
simpleOid.setInternalName(encodedBeanKey);
} catch (JSONException ex) {
ex.printStackTrace();
}
setOid(simpleOid);
}
}
Add a hidden input field in your form for each row in the MVC table. This hidden field will store the row ID or any other relevant identifier. Use JavaScript to capture the submit button click and populate the hidden field with the row ID corresponding to the clicked button. When the form is submitted, the hidden field value will be included in the request parameters. When the form is submitted, the hidden field value will be included in the request parameters.
Hello SG_9899099,
Was the information provided helpful somehow ?
KR,
Charles.
Hello Charles,
I managed to get the data what I need in Oid String . My problem got resolved . Thank you so much for your help.
I have extended the NmObject to my custom Bean created a URL encoded Json Object and setting that as Oid. In the Json object I have input all the needed data. Below is the code I used. I got the values in formprocessor using getNmOidSelected().
public class customBean extends NmObject {
String partNumber;
String partName;
String partState;
String locationName;
String clientNumber;
String plantNumber;
boolean nonSelectableRow;
public customBean () {
}
public customBean (WTPart selectedPart, WTPart selectedDownStreamSystem, boolean updateFlag,String traType)
{
updateNmOid(selectedPart, selectedDownStreamSystem, updateFlag,traType);
}
private void updateNmOid(WTPart selectedPart, WTPart selectedDownStreamSystem,String traType)
{
NmSimpleOid simpleOid = new NmSimpleOid();
JSONObject joNmOid = new JSONObject();
try {
joNmOid.put("selectedPartOid", selectedPart.getPersistInfo().getObjectIdentifier().toString());
joNmOid.put("selectedDssOid", selectedDownStreamSystem.getPersistInfo().getObjectIdentifier().toString());
joNmOid.put("updateFlag", updateFlag);
joNmOid.put("transferType", traType);
String encodedBeanKey = Base64.encodeBase64URLSafeString(joNmOid.toString().getBytes());
simpleOid.setInternalName(encodedBeanKey);
} catch (JSONException ex) {
ex.printStackTrace();
}
setOid(simpleOid);
}
}
@SVG_10111100101
I am more interested with this solution approach . i have a question on your code , how did you managed to get the below selected objects in your table builder custom bean class.
I believe you used the custom bean to render the data in your custom table builder columns .
selectedPart
selectedDownStreamSystem
traType
Hello MS,
In buildComponentData method of table builder class, while creating this custom bean object I'm passing these params . In buildComponentData method I'm getting these parameters from nmCommandBean.getNmOidSelectedInOpener. My requirement is is to get the part number on which I opened the my action . So I got that in this way . One more thing is you need to use setType API while in buildComponent method.
table.setTypes("ext.someOrg.customCodepkg.CustomeBean");
For code custom bean you refer my above answer. Below is the example code. Hope this clarifies your doubt.
public Object buildComponentData(ComponentConfig componentConfig, ComponentParams componentParams) throws Exception {
NmHelperBean helperBean = ((JcaComponentParams) componentParams).getHelperBean();
NmCommandBean commandBean = helperBean.getNmCommandBean();
ArrayList<NmOid> nmOidSelectedList = commandBean.getNmOidSelectedInOpener();
for (NmOid nmOidSelected : nmOidSelectedList) {
Object refObj = nmOidSelected.getRefObject();
if (refObj instanceof WTPart) {
WTPart selectedPart=(WTPart) refObj;
//Somebusiness logic for getting selectedDownStreamSystem and traType
CustomBean bean = new CustomBean(selectedPart,selectedDownStreamSystem,traType);
list.add(bean);
}
}
return list<bean>;
}