on 08-19-2006 11:14 AM
Hi All,
Why we use calculated property for a context attribute as true? Give me an example.
Regards
DK
Hi DK,
Calculated Property is required when you want to handle node context attribute programmatically.
When you say Context Attribute as True, it generates two methods, Setter and Getter Method for that attribute.
In getter method you will be getting one element it is the context node, where you created attribute. These methods will be called automatically.
If you want to pass calculated value to the table and then use the context attribute property as calculated. In the getter method you do the calculations.
For more information refer this link.
http://help.sap.com/saphelp_nw2004s/helpdata/en/7f/a0384162316532e10000000a1550b0/frameset.htm
Example :
In the below example, converting the result node integer value to string.
Regards,
Sridhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Calculated attributes are a handy way for combining or transforming attributes of the same node.
Example: You have an attribute "Value" storing some numeric value and you want to give a TextView a certain color, if the value is negative.
Then you can create a calculated (read-only) attribute "TextColor" of type "TextViewSemanticColor" and bind the "semanticColor" property of a TextView to this attribute.
In the generated getTextColor() method, you simply write
WDTextViewSemanticColor getTextColor(I<Node>Element element)
{
return element.getValue() < 0
? WDTextViewSemanticColor.NEGATIVE
: WDTextViewSemanticColor.STANDARD;
}
Same technique may be used to set other UI element state (enabled, read-only) depending on existing attribute values.
More applications: Formatting of "display" values.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.