on 11-22-2006 2:02 PM
Hi all.
I am customizing the WebDynpro CATS screen.
Because the table fields are dynamic generated. So there is only one node without attributes inside the context.
How can I get all attributes name and value for this node ? Because I want to add more node attributes.
I tried in debug mode, but it does not help.
anybody can give me some help ?
U can retrieve attribute names using attribute iterator
wdContext.nodeName().getNodeInfo().iterateAttributes();
Iterator iter1 = wdContext.nodeName().getNodeInfo().iterateAttributes();
//
for (; iter1.hasNext();) {
String tmp = iter1.next().toString();
String attributeName =
tmp.split("\.")[tmp.split("\.").length- 1].split("\)")[0];
}
Hope it helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What's this toString() and split-fiddling good for? Why not like this:
IWDNodeInfo nodeInfo = wdContext.node<Node>().getNodeInfo();
for (Iterator it = nodeInfo.iterateAttributes(); it.hasNext(); )
{
IWDAttributeInfo attInfo = (IWDAttributeInfo) it.next();
String attName = attInfo.getName();
}
Armin
Armin,
Frankly, first time I saw IWDNodeInfo API, I was wondering myself what this iterator returns: IWDAttributeInfo or just name of attribute for subsequent call to IWDNodeInfo.getAttribute(name). The documentation is ("was", at least) not clear about this.
Same is for many UME API -- it's unclear whether uniqueID or object itself is returned in many cases. The only way is to try first option and get ClassCastException
Sure, new version that is based on Java 5 (as far as next WebAS is J2EE5) will clean up these issues altogether with generics, i.e:
Iterator<IWDAttributeInfo> IWDNodeInfo.iterateAttributes();
Valery Silaev
SaM Solutions
It works. thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It works, thanks a lot.
Your answer greatly helps me
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, I will try it tomorrow.
Can I use the say way to get all column fields of one dynamic table ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Try this and let me know if it works...
for (int i = 0; i < ValueNode.size(); i++) {
ValueNode.setLeadSelection(i);
//get child node name
int NumFlds =
ValueNode.getNodeInfo().getStructureType().getNumberOfFields();
for (int count = 0; count <= NumFlds; count++) {
IField Fld =
ValueNode.getNodeInfo().getStructureType().getField(count);
if (Fld != null) {
FieldName = Fld.getName();
wdComponentAPI.reportSuccess("Fld" + FieldName + "Val" + ValueNode.getElementAt(i).getAttributeValue(FieldName));
}
}
}
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.