on 12-02-2005 12:32 PM
Hi all,
Is there anyway that u directly read a node element whose value attribute is say 'AAA' without looping throgh all the node elements.
For example i have Student data node with value attrubutes id,name,etc.
now for this node i want to read the element with id 'A1234'.
instead of getting the size of the node and looping through the entire node and match the id, i want a method which returns the corresponding node element which satisfies the criterion.
Thanks
Vijaya
Hello Vijaya,
AFAIK, there is no direct way. As workaround you can create map context attribute, iterate through node elements and store attribute (id) as key and node element as value. The problem is that you have to create such map for every attribute you need.
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
It is possible to get the att value inside the node using the method <b>getElement("String name")</b>.
Hope this helps u,
Regards,
Nagarajan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Nagarajan,
What kind of thing are you talking about? What is "attribute value inside the node"? Element inside the node you can access through getCurrentElement(), getElementAt(int index), move*() methods.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/javadocs/nw04/sp12/web dynpro runtime environment/com/sap/tc/webdynpro/progmodel/api/iwdnode.html .
Attributes inside element you can access through getAttributeValue(String attributeName), getAttributeAsText(String attributeName) methods.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/javadocs/nw04/sp12/web dynpro runtime environment/com/sap/tc/webdynpro/progmodel/api/iwdnodeelement.html
Attributes you can access through IWDNodeInfo class and getAttribute(String name) method
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/javadocs/nw04/sp12/web dynpro runtime environment/com/sap/tc/webdynpro/progmodel/api/iwdnodeinfo.html
But, what is "att value inside the node" ?
Best regards, Maksim Rashchynski.
hi nagarjuna,
can u pl little elaborate on this code. suppose
the node structure is as follows and it contains data in it.
Student (node)
|_ id (value Attributes)
|_ name
|_ address
instead of the following code
String Code = "A1234";
max = wdContext.nodeStudent.size();
for(int i = 0; i < max ; i++)
{
IStudentElement student = wdContext.nodeStudent().getStudentsElementAt(i);
if(Code.equals(student.getId())
{
// do some process
}
}
here the node contains only entry with id. so i neither want to loop through the entire elements nor break once the there is success, if there is any other method.
Thanks in advance
Vijaya
you can use the break java statement inside the if inside the for
String Code = "A1234";
max = wdContext.nodeStudent.size();
for(int i = 0; i < max ; i++)
{
IStudentElement student = wdContext.nodeStudent().getStudentsElementAt(i);
if(Code.equals(student.getId())
{
// do some process
break; //this will end the for(...) when you find the student
}
}
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
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.