on 11-01-2008 10:27 AM
Hi
I have a context node Vn_Node and Va_att is the attribute for it.
I am binding values to Va_att at runtime. How can i eliminate duplicates like if i get 3,3,3,10 in Va_att, I want only 3,10 to be there in Va_att.
Kindly suggest.
I didnt understand. Do u mean that for the same code i have written i need to add this for removing
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can anybody suggest me what is the correct procedure to remove the duplicate values...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, Its not giving the correct result.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if i put n=1, if it has duplicate values its working fine. Otherwise its not working.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Instead of removing duplicate elements from the context node you can try to add only unique values to the context.
Just create the Set with the values, which u r getting dynamically, and then add this set values to node attributes.
I hope it solves your problem
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, It removed all 3's.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In my case i have values in my att like 3,3,3,10. But I want to remove the repeated 3's.
When i use the following code it removes only one 3 and final values in my context after executing below code are 3,3,10.
Kindly suggest.
for(int m=0;m<wdContext.nodeVn_dlr3_1().size();m++)
{
for(int n=m1;n<wdContext.nodeVn_dlr3_1().size();n+)
{
if(wdContext.nodeVn_dlr3_1().getVn_dlr3_1ElementAt(m).getVa_dlr3_1().equals(wdContext.nodeVn_dlr3_1().getVn_dlr3_1ElementAt(n).getVa_dlr3_1()))
{
IWDNodeElement nodeelement=wdContext.nodeVn_dlr3_1().getVn_dlr3_1ElementAt(n);
wdContext.nodeVn_dlr3_1().removeElement(nodeelement);
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
To filter duplicate values you can create new Node Vn_Node_Filtered and attribute Va_att_Filtered with filtered data and make use of this node.
IPrivateView.IVn_Node Model_node = wdContext.nodeFromModel();
IPrivateView.IVn_Node_Filtered Finalnode = wdContext.nodeVn_Node_Filtered();
for(int i=0;i<node.size();i++){
int value = Model_node.getElementAt(i);
boolean flag=true;
for(int j=0;j<Finalnode.size() && flag == true;j++){
if(value == Finalnode.getElementAt(j)){
flag = false;
}
}
if(true){
addElement in FilteredNode = value.
}
}
Regards,
Lakshmi Prasad.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can u just post your code how are you binding values to attribute at runtime like are you using ArrayList or what, such that it will be easy to suggest you a solution or else i think the following code will help you
for(int i==0;i<wdContext.node().size();i++)
{
if(wdContext.currentVnNodeElement().getVaAttr()==wdContext.VnNode().getVnNodeElementAt(i).getVaAttr())
{
wdComponentAPI().getMessageManager().reportSuccess("you have entered duplicate values");
}
else
create the element and bind the element to node
}
Regards
Raghu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.