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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

The customized dataUtility of WTPart's attribute can't show Part > Structure page.

YT_9085185
4-Participant

The customized dataUtility of WTPart's attribute can't show Part > Structure page.

I defined a datautility to control the display text of some Attributes, but when I looked on the attribute tab of the structure Tab, I didn't see it as I saw it on the main attribute page(first Tab). When I debug the attribute of the structure tab, I found that it would enter the getPlainDataValue method of DataUtility. But the first parameter to this method is just the id of the registered datautility instead of the normal component id, so how do I get the original value of the component with datautility set?

 

 

 

 

7 REPLIES 7

HI @YT_9085185 

You need to implement  LogicSeparatedDataUtility 

public class MyDataUtility extends AbstractDataUtility implements LogicSeparatedDataUtility
{
}

 

Then you can use method in your DU

public Object getPlainDataValue(String columnName, Object rowObject, ModelContext modelContext) throws WTException
{
return ((ConfigPropertiesItem) rowObject).getFileName(); // own object where filename is return as a string
}

 

Just use the original function in the getPlainDataValue and convert the value to a String that is shown in the structure

 

this.getDataValue(columnName, rowObject, modelContext);

 

 

PetrH

I tried it your way. I couldn't get anything.The ID is still the ID of datautility.As an alternative, I'm going to define multiple DUs, each configured to a fixed attribute.

tks

pic1.png

Hi @YT_9085185

the gerDataValue needs to be defined in you class, and you need to get the values. 

String id is the attribute ID Object is the row object that is shown, and ModelContext is where the other information from the browser are stored.

From that you need to get value what you need by your code. 

 

PetrH 

The getDataValue method takes its first argument from the getPlainDataValue method because getDataValue is called from getPlainDataValue. The problem now is that I can't know the component_id of the attribute that uses this DU, so I can't get the value I need in getDataValue

@YT_9085185 

the ID is forwarded from the system where DataUtility is defined.

So if the data utility is run for attribute name, the ID is name if the attribute is IBA MYATTRIBUTE then the id usually is IBA|MYATTRBUTE but it is not rule. It can be just MYATTRBUTE 

 

so if your ID is null then you did something wrong. 

 

PetrH

The ID is not null.In my experience, when we call a DU, the id is the name of the IBA, but this page,the nameis the selector for DU, and I'm doing DU on this page for the first time, so I'm confusedpic2.png 

Hi @YT_9085185 

I would like to know how do you set the DataUtility to attribute and how the servise.properties definition row looks like

because I've never see that ID in getPlainDataValue

my example is for PART_NO 

HelesicPetr_0-1693485209332.png

but in the service.properties the selector is PART_NO 

 

PetrH

Announcements

Top Tags