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

Translate the entire conversation x

How to get the custom table data in the form processor

MS_9630520
10-Marble

How to get the custom table data in the form processor

Version: Windchill 12.0

 

Use Case: we have build a custom wizard which contains the MVC table builder . Data for this table is provided via custom Bean object with getters and setters for each column . Now i want to get all the table data rendered in each rows in my formprocessor doOperation method .


Description:

we tried to get the table data using the below  api , always i am getting null  as return value .

commandBean.getInitialItemsByName("ext.plm.builders.PLMCustomTableBuilder")

Steps to reproduce this issue :
1.Create the custom wizard with table builder like below 

public Object buildComponentData(ComponentConfig compConfig, ComponentParams compParams) throws Exception {
NmCommandBean nmCommandBean = ((JcaComponentParams) compParams).getHelperBean().getNmCommandBean();
return new PLMDemoTableBean(nmCommandBean);
}
@Override
public ComponentConfig buildComponentConfig(ComponentParams componentParams) throws WTException {
ComponentConfigFactory factory = this.getComponentConfigFactory();
TableConfig tableConfig = factory.newTableConfig();
tableConfig.setLabel("Demo Table");
tableConfig.setId("ext.plm.builders.PLMCustomTableBuilder");
tableConfig.setTypes(PLMDemoTableBean.class.getName());

ColumnConfig numberColumnConfig = factory.newColumnConfig("partNumber", true);
numberColumnConfig.setSortable(true);
numberColumnConfig.setLabel("Number");
tableConfig.addComponent((ComponentConfig)numberColumnConfig);

ColumnConfig versionColumnConfig = factory.newColumnConfig("customAttr", true);
versionColumnConfig.setSortable(true);
versionColumnConfig.setLabel("Data1");
tableConfig.addComponent((ComponentConfig)versionColumnConfig);
return tableConfig;
}

2. I have defined the getters and setters for both partNumber and customAttr  PLMDemoTableBean class.
3.Create a formprocessor for the custom wizard action and get the table data (ie PLMDemoTableBean  object) in the doOperation method using the  api

commandBean.getInitialItemsByName("ext.plm.builders.PLMCustomTableBuilder")

 
 





6 REPLIES 6
HelesicPetr
22-Sapphire II
(To:MS_9630520)

Hi @MS_9630520 

Usually you have to use the right method to build a table in a wizard with internal ID then you could try to use List<NmOid> tableInfo = (ArrayList) nmCommandBean.getItemsToRender("tableID"); to get information from the table.

 

aslo all information from the wizard is stored in several array lists

HashMap textArea = nmCommandBean.getTextArea();
HashMap checked = nmCommandBean.getChecked();
HashMap unChecked = nmCommandBean.getUnChecked();
HashMap radio = nmCommandBean.getRadio();
HashMap text = nmCommandBean.getText();
HashMap comboBox = nmCommandBean.getComboBox();

each element in the list contains ID of the specific row from the table and name of the parameter.

 

PetrH

Hi @HelesicPetr ,

I tried your suggestion  of using this  List<NmOid> tableInfo = (ArrayList) nmCommandBean.getItemsToRender("tableID") API in preprocess method   unfortunately the i am gettling empty list from this API.
Problem i am facing only for fetching the table data . for other attribute  panel builder field i am able to get the values directly using other APIs shared above . 

Can you please advice do i need to enabled any  wizard or table configuration to fetch my table data in code

Hi @HelesicPetr 

 

I am able to get the user editable column via the APIs you have listed  below ,but in my case i have some columns which is view only  and data rendered from the custom business logic (using some engineering design formula ).  unfortunately i can;'t use any of the api listed below to fetch this calculated data rendered in the column . 

Any suggestion to fetch the non data utility  table column data ??


HashMap textArea = nmCommandBean.getTextArea();
HashMap checked = nmCommandBean.getChecked();
HashMap unChecked = nmCommandBean.getUnChecked();
HashMap radio = nmCommandBean.getRadio();
HashMap text = nmCommandBean.getText();
HashMap comboBox = nmCommandBean.getComboBox();

 
Could  you please help me why the PTC documented APIs List<NmOid> tableInfo = (ArrayList) nmCommandBean.getItemsToRender("tableID") ;
commandBean.getInitialItemsByName("tableID") ;


commandBean.getAddedItemsByName("tableID") ;   
are not usable to get the data of each object in cutom wizards . i have used this in the OOTB change task resulting table builder where it works fine .

HelesicPetr
22-Sapphire II
(To:MS_9630520)

Hi @MS_9630520 

So you have to use the calculated data logic that can be used in the processor. 

Otherwise you are in a trap. 

 

I always use an input from own datautility or windchill logic definition so the api works.

I do not know any other method.

I can just imagine that you have to use some java script that write the page information in the request or http address that you can read it anywhere. 

I usually use an extraData in the http request  and I save information there and I can pickup it anywhere but it has some limitation that one user can do an operation in one browser where the information has been saved. If he use another place it can be rewrite. 

PetrH

Hi @HelesicPetr 

Thanks for your suggestion .
I just created a datastore  hidden editable  column in  my table builder and render the data with datautility . with that approach i am able to get the required data in form processor with  below method .

nmCommandBean.getText();

 Just one final question in your suggestion to use the Httprequest to store the column data . whether the data stored in the httprequest will be passed from the one wizard step to another wizard step and to formprocessor ?

HelesicPetr
22-Sapphire II
(To:MS_10124549)

Hi @MS_10124549 

Try it. You will see.

PetrH

Announcements
Top Tags