on 03-17-2009 11:51 AM
Hi,
I read some docs about calculated attribute but i couldn't get the real advantage of it. I know this is very much usefull when we are using file download UI element in table.
One document says this will be usefull to calculate he total price of a shopping cart. I think instead of using this calculated attribute we can use normal attribute, where we can store the total price.
Please let me know what are advantages of this calculated attribute.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The benefit of the calculated attribute is, its getter method get called everytime the nodelement is accessed.
So if you want one attribute to get calculated whenever there is a change in any of the attribute in the node element, you can write the logic in the calculator method.
For example Total value Calculation. It should be updated everytime there is a change in quantity in any of the attribute of the node. If there is a button to increase value and another button to decrease value.
You have to make sure total calculation is present in both buttons' event handler.
It is also useful for displaying text for a selected value from EVS.
Hope this helps!
Monalisa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check this eBook (Chris Whealy):
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your reply.
I have gone throgh the vedio. my doubt in the given example in the vedio is..
after clicking button only we are getting salutation. If that is the case we can use one more normal attribute instead of calculated attribute and we can form the salutation and we can assign the value to attribute.
Let me know what is the advantage we are getting using this calculated attribute.
Thanks
Hi
A calculated attribute is an attribute that is not stored by the element, but calculated each time the attribute is accessed. Therefore it must be marked in the IDE and controller methods must be declared.
Calculated attributes can have getters and (unless they are read only) setters. The getter calls the declared controller method with the following signature:
AttrClass getNodenameAttributename(NodenameElement element);
It is expected to calculate and return the value based on other values of the element.
The setter is only generated if the attribute is not marked read only. It has the following signature:
void setNodenameAttributename(NodenameElement element, AttrClass value);
This method is expected to modify other attributes of the element based on the given value. It does not mark anything changed by itself. Only the modification of other attributes leads to updates of the GUI.
(The above method names are proposals of the IDE. You may change them.)
you could use the getter in order to get a form of address like "Mr. Metodi Mladenov" from the following fields of an address book: Last Name, First Name, Gender, Address.
Advantage is : Implementing some intelligence based on the given data like if Customer Code is DEL123011
so(and it is given that it start from City<ddd>code) so we can retrieve city + City code information based on this infromation
Best Regards
Satish Kumar
Edited by: satish jhariya on Mar 17, 2009 6:09 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.