on 04-11-2009 6:22 AM
hi,
I have one value node...i need to get maximum value from the lements added in it..
For e.g. suppose my value node name is Material and it has two attribute lineitem and material.
so now
Material
lineitem name
001 Winding
003 Screw.
005. Machine.
004 Transformer
002 Coil
Currently..i have run loop on this node and fetched maximum value by comparing each element (i.e 005)... can directly fetched value 005 without running loop..
Regards,
Jigar Oza
Hi Expert
if you want to make it shorting ascending order of node value.then you can compare the node value using
wdContext.nodeMaterial ().sortElement(){
new comparator(){
public int compare(Object x,Object y){
Integer a=new Integer((IWDNodeElement)x).getAttributeValue("lineitem").toString());
Integer b=new Integer((IWDNodeElement)y).getAttributeValue("lineitem").toString());
if(a==null){
return b=null?1:0;
}
return a.compareTo(b);
}
}
}
try to this above code it will sort ascending order of node...
thanks
jati
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The loop should be no performance problem. Another possibility is to store the node element with the maximum value in a separate context attribute and update this attribute whenever an element is added or removed from the node. But I doubt it is worth this effort.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jigar,
For getting the highest value from the Node u can sort the Node in which u maintain the values (if the values are not coming from the Backend). If the values are copied from a RFC structure, then u can instruct the RFC developer to sort the table in the highest order of the key such that the maximum value is always in the first row before sending it to you. By this u can set the lead selection property of the value node to the first element of the Node.
In this way u can always get the highest value of the table without looping.
Regards,
Poojith M V
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.