cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot loop through values in Node

Former Member
0 Kudos

Hi Everyone,

I am using a TreeNestedInTable UI. I have 2 columns: a Master Column with a TextView Cell Editor, and a field called "Check" whereby one of the values in the Master Column can be selected. The "checked" attribute of the Check column is mapped to a isChecked attribute in my Node that contains all the data being displayed in the TreeNestedInTable (IncidentAgent Node).

I would like to loop through all the Check boxes ticked in this TreeNestedInTable and get the corresponding Value to write to a Test Node (to make sure that I am in fact reading all cheked rows).

I do not seem to, however, get all the values checked. Please see my code below and comment. I am testing and so I put a button on the screen that should loop through all the values and see which ones are checked. It should then write these checked valus to a node that is also linked to a table control on the screen. The Idea is that each time you check a few values they should be displayed in this table control when the button is pressed. This is not happening - the table stays blank.

public void onActionSeeIACollection(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionSeeIACollection(ServerEvent)

IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();

//New Element added each time:

ITEST_IA_NODEElement newElement;

//Incident Agent element:

IIncidentAgentElement agentElement;

//Loop through ALL the IncidentAgent Elements and see which ones hace got the "Check" value

//flagged:

for(int i=0;i<wdContext.nodeIncidentAgent().size();i++)

{

//Get the currently processed element:

agentElement = wdContext.nodeIncidentAgent().getIncidentAgentElementAt(i);

//If the Check value is flagged, add it to the TEST_IA_NODE node:

if(agentElement.getCheck())

{

newElement = wdContext.createAndAddTEST_IA_NODEElement();

newElement.setVALUE(agentElement.getVALUE());

msgMgr.reportSuccess(agentElement.getVALUE());

}//end if

}//end for

//@@end

}

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You need to change this to a recursive function to iterate through the children too..

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

Not too sure what you mean. My IncidentAgent Node (main node with all data) is a Node with a recursive node.

The TEST_IA_NODE is not a recursive node. It is just a "regular" node with one attribute. Because it is agains the Root node (Context) I cannot make the Singleton attribute "false". Do I then need to add a Recursice Node to the TEST_IA_NODE and leave the code as is? i tried this and I still have the same problem.

Please advise.

Christiaan

Former Member
0 Kudos

Hi,

Could you please post your context structure?

Regards

Ayyapparaj

Former Member
0 Kudos

Sure. Thank you for your help.

"Data Containing" Node:

h1 IncidentAgent(Top Level Node)

h2 RecursiveNode(Pointing to IncidentAgent as recursiveNode)

h4 Check (boolean attribute)

h4 ChildrenLoaded (boolean attribute for TreeNestedInTable)

h4 Expanded (boolean attribute for TreeNestedInTable)

h4 IsLeaf (boolean attribute for TreeNestedInTable)

h4 NODE_ID (attribute)

h4 PARENT_ID (attribute)

h4 VALUE (attribute)

Collection Cardinality: 0...N

Selection Cardinality: 0...N

Singleton: TRUE

Node that should contain VALUE attribute from node above if Check attribute above is checked

h1 TEST_IA_NODE

h4 VALUE

Collection Cardinality: 0...N

Selection Cardinality: 0...N

Singleton: TRUE