on 06-25-2009 12:18 PM
HI,
I have imported one RFC from backend and in that RFC i have 2 structures.In first structure i have 6 colmuns and in second strucutre i have 8 colomuns and one common column is there for comparing the data.i wrote this logic
Structure s1, s2
Table node tablenode
for( loop s1){
IPrivateXXXXview.itablenode nodeElement = wdContext.createTablenodeElement();
wdContext.node.addElement(nodeElement);
nodeElement.setAtr1(s1.getattr1());
nodeElement.setAtr2(s1.getattr2());
...
..
nodeElement.setAtr6(s1.getattr6());
for(loop s2){
if(s1.id == s2.id){
nodeElement.setAtr1(s2.getattr1());
nodeElement.setAtr2(s2.getattr2());
...
..
nodeElement.setAtr6(s2.getattr6());
}
}
}
the values from first structure are populating fine in table but the values from second struture are not populating the correct values in the same table.Only one value is populating from structure in all rows.
Can anybody give me clue in this issue.
In first strucuture i have 16 records and in second structure i have 10 records.
Regards,
Prasad
Hi If you have the nodes as below
UsersListModelNode --> This is having the attribtue UserId, User Name
UserDetailsModelNode --> This is having attributes UserId, Desination, Role ..etc
Now you have created one value node as below and binded this node to table
UsersValueNode --> This is having the attributes UserId, UserName, Designation, Role..etc
Now populate the combined values of both the model nodes as below into value node.
int sizeUsersListModelNode = wdContext.nodeUsersListModelNode().size();
HashMap userElements=new HashMap():
for(int iCount=0;iCount<sizeUsersListModelNode;iCount++)
{
IPublicTestComp.IUsersValueNode element=wdContext.createUsersValueNodeElement();
element.setUserId(wdContext.nodeUsersListModelNode().getUsersListModelNodeElementAt(iCount).getUserId());
element.setUserName(wdContext.nodeUsersListModelNode().getUsersListModelNodeElementAt(iCount).getUserName());
wdContext.nodeUsersValueNode().addElement(iCount, element);
userElements.put(wdContext.nodeUsersListModelNode().getUsersListModelNodeElementAt(iCount).getUserId(), iCount);
}
int sizeUserDetailsModelNode = wdContext.nodeUserDetailsModelNode().size();
for(int iCount=0;iCount<sizeUsersListModelNode;iCount++)
{
String userId=wdContext.nodeUserDetailsModelNode().getUserDetailsModleNodeElement(iCoung).getUserId();
String userDesignation=wdContext.nodeUserDetailsModelNode().getUserDetailsModleNodeElement(iCoung).getUserDesignation();
String userRole=wdContext.nodeUserDetailsModelNode().getUserDetailsModleNodeElement(iCoung).getUserRole();
if(null!=userElements && userElements.contains(userId)
{
int elementNo=Integer.parseInt(userElements.get(userId).toString);
wdContext.nodeUsersValueNode().getUsersValueNodeElementAt(elementNo).setUserDesignation
(userDesignation));
wdContext.nodeUsersValueNode().getUsersValueNodeElementAt(elementNo).setUserRole
(userRole));
}
}
Regards,
Charan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
I think you want to make a join of both structures and put them on a single table
...the only thing I would change is the overwritting you are doing ... you are setting the Atr1 two times
Structure s1, s2
Table node tablenode
for( loop s1){
IPrivateXXXXview.itablenode nodeElement = wdContext.createTablenodeElement();
wdContext.node.addElement(nodeElement);
nodeElement.setAtr1(s1.getattr1());
nodeElement.setAtr2(s1.getattr2());
...
..
nodeElement.setAtr6(s1.getattr6());
for(loop s2){
if(s1.id == s2.id){
nodeElement.setAtr7(s2.getattr1());
nodeElement.setAtr8(s2.getattr2());
...
..
nodeElement.setAtr10(s2.getattr6());
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
then try to debug the data you are getting from RFC
you can try putting two tables on the ivew and mapping it to the structures from the RFC
maybe the values you are getting are just blank
..try to print some messages inside the loops
wdComponentAPI.getMessageManager().reportSuccess("enter loop 2, value of attr2:"+attr2);
Hi Prasad,
Here I am assuming that the required data is present in the node s1 and node s2.
Structure Node u2013 s1,s2
Table Node u2013 tablenode
wdContext.nodeS1().moveFirst();
IPrivateXXXXview.itablenode nodeElement;
for( loop s1){
nodeElement = wdContext.createTablenodeElement();
wdContext.node.addElement(nodeElement);
wdContext.nodeTablenode().moveLast ();
nodeElement.setAtr1(s1.getattr1());
nodeElement.setAtr2(s1.getattr2());
...
..
nodeElement.setAtr6(s1.getattr6());
for(loop s2){
wdContext.nodeS2().moveFirst();
if(s1.id == s2.id){
nodeElement.setAtr7(s2.getattr1());
nodeElement.setAtr8(s2.getattr2());
...
..
nodeElement.setAtr10(s2.getattr6());
}
wdContext.nodeS2().moveNext ();
}
wdContext.nodeS1().moveNext();
}
Revert back if there is any problem.
Best Wishes
Idhaya R
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.