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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Translate the entire conversation x

Map attributes value to a custom Tab

SK_12337814
8-Gravel

Map attributes value to a custom Tab

I have a scenario where there is an attribute (say Sample String1)which has a pair of json values("bat:MRF, ball:stumper, team:csk")

 

Now I will have to display these values as "Attribute-value" pair in a custom Tab which I have created.

 

Note: These Json values are received from another third party tool, we need to display these as attribute value pair in the custom Tab.

 

Need guidance and help on how to achieve this.

3 REPLIES 3

Using custom MVC attribute panel builder you can render the key- value pair in the simple string component 

Do we have any sample implementation cpde for this..Im a beginner in customisation and need guidance

Hi @SK_12337814 
1.Create the action for your panel builder and define the component in the action.
2.Define the submodel for the custom tab in the custom-actionModels.xml  under your object specific model. and add the custom action created in step 1.

3.Create the required attribute(bat,ball,team) in type and attribute management 
3. Refer this MVC attribute panel builder and update to your requirement 

public class customAttributePanel extends AbstractComponentBuilder {
 
public Object buildComponentData(ComponentConfig paramComponentConfig,
ComponentParams paramComponentParams) throws WTException {
NmHelperBean localNmHelperBean = ((JcaComponentParams) paramComponentParams)
.getHelperBean();
NmCommandBean cb = localNmHelperBean.getNmCommandBean();
Persistable persistable = (Persistable) cb.getPrimaryOid().getRef();
return persistable;
}
 
public ComponentConfig buildComponentConfig(
ComponentParams paramComponentParams) throws WTException {
 
 
 
 
//tableconfig.setShowCount(true);
//tableconfig.setRowBasedObjectHandle(true);
ComponentConfigFactory localComponentConfigFactory = getComponentConfigFactory();
AttributePanelConfig localAttributePanelConfig = localComponentConfigFactory
.newAttributePanelConfig();
 
localAttributePanelConfig.setComponentType(ComponentType.INFO_ATTRIBUTES_TABLE);
localAttributePanelConfig.setLabel(" ");
JcaGroupConfig localJcaGroupConfig = (JcaGroupConfig) localComponentConfigFactory
.newGroupConfig();
localJcaGroupConfig.setId("CustomAttributes");
localJcaGroupConfig.setLabel("DEMO");
 
JcaAttributeConfig localJcaAttributeConfig2 = (JcaAttributeConfig) localComponentConfigFactory
.newAttributeConfig();
localJcaAttributeConfig2
.setLabel("BAT");
localJcaAttributeConfig2.setId("BAT");
localJcaGroupConfig.addComponent(localJcaAttributeConfig2);
localJcaAttributeConfig2 = (JcaAttributeConfig) localComponentConfigFactory
.newAttributeConfig();
localJcaAttributeConfig2
.setLabel("BALL");
localJcaAttributeConfig2.setId("BALL");
localJcaGroupConfig.addComponent(localJcaAttributeConfig2);
localJcaAttributeConfig2 = (JcaAttributeConfig) localComponentConfigFactory
.newAttributeConfig();
localJcaAttributeConfig2
.setLabel("Team");
localJcaAttributeConfig2.setId("Team");
localJcaGroupConfig.addComponent(localJcaAttributeConfig2);
localAttributePanelConfig.addComponent(localJcaGroupConfig);
 
return localAttributePanelConfig;
}

 

 

 

Announcements
Top Tags