cancel
Showing results for 
Search instead for 
Did you mean: 

Convert UI Table column value?

Former Member
0 Kudos

Hi,

I have written a WD Java app which retrieves list of records from ECC using RFC and I have bind it to a WD UI table. One of the column in the UI table is bound to a active status (i.e. true of false). The default value displayed in the UI table active status column is "true" or "false". My requirement is to change this default text appearing on the View to "Active" or "Inactive" text, how do I do it?

This change is only for display purpose.

Thanks

Siva

Edited by: Siva Vummiti on Nov 11, 2009 1:48 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I think the best way to solve this is creating a new Context Attribute, type String, readonly true, calculated true. Instead of having you column using you boolean value, use this new attribute.

The implemenation of the calculated method would be something like:


... getStatusDescription(IWDNodeElement element) {
return (element.getActive() ? "Active" : "Inactive");
}

Hope it helps,

Daniel

Former Member
0 Kudos

I read about this calculated attribute. I understand your coding sample, my issue is

The Model context structure is

Context

-


RFCModelNode (Model Node)

-


OutputNode (Model Node)

-


TableResultNode (Model Node)

-


Active (Model Attribute)

NOTE: treat the above context as a hierarchy (top level is RFCModelNode, bottom level is Active). When you view this post all the above tree is displayed in the same level.

I'm not able to create a value attribute at TableResultNode which has cardinality of 0..n I get message that "Adding attributes is currently not supported if the node or the model class (for context model nodes) has a dictionary structure bindings".

I'm only able to create new value attribute at RFCModelNode and OutputNode.

How do I create value attribute at TableResultNode level? So that I can refer to element.Active and return correct string type.

Thanks

Siva

Edited by: Siva Vummiti on Nov 11, 2009 2:33 PM

Former Member
0 Kudos

Hi,

What I usually do is declare a new Custom Controller under the Component level. This CCT will perform the backend operation and move the Model Values into Node Values (Component Level). Even in the Component level, if you have your Node binded to a structure you will not be able to add any attributes under it.

You have two options:

- Either you delete your "Structure Binding" in your Value Node and you are free to add / remove attributes from that node, or;

- You create a new Node under your TableResultNode, singleton = false, card. 1:1, selection 1:1 and add your new attribute in there.

You still can use the calculated attribute, but you need to read the "Parent" node attribute value "Active".

Regards,

Daniel

Former Member
0 Kudos

Daniel thanks again. I choose the second option that you mentioned and created a value node and value attribute. In the implementation I have written something similiar

IPrivateOverview.I<Parent>Element parentElement = (IPrivateOverview.I<Parent>Element)element.node().getParentElement();

return (parentElement.getActive() ? "Active" : "InActive");

Please let me know if I need to correct above.

Now in the view context when I try to use creat binding wizard for table UI, I can either select new calculated attributed or select the other original attributes. I cannot select all the required attributes. Is this because of cardnality or subnode of parent?

Thanks

Siva

Former Member
0 Kudos

Hi,

When you use the Table Template, it will only let you select your "Base Node" for that Table. Use your "Main Node", select everything you want. Remember, you dont need the Active anymore, since you created a new Attribute to "format" that Boolean value.

After that, you can "CTRLC / CTRLV" one of your columns and manually edit it's property or create a new column in the Table.. You will be using a TextView as CellEditor for this new column, mapping to your newly created attribute.

Regards,

Daniel

Former Member
0 Kudos

Thanks Daniel. The issue is resolved.

For some reason the new node that I created under result node, as I said I was not able to select calculated attributed when parent element attributes were selected. I had totally 5 columns in table UI and last column was this Active column. I picked the last column and manually edited TextView--Text property binding to the calculated attribute which fixed the issue. Not sure if I have done the right thing here.

Thanks

Siva

Former Member
0 Kudos

That's how I do it. I'm not sure if there's any other better alternative.

Cheers,

Daniel

Answers (0)