cancel
Showing results for 
Search instead for 
Did you mean: 

While

Former Member
0 Kudos
40

Hi..

I need to know how to do a while in web dynpro.

I have one node (is a table, cardinality 0..n), with many parameters inside.

I need to navigade, with a while, between this records...

something like:

int intTotal = wdContext.currentDataElement().otherContextElement().getSize() //or something like this...

while(int x=0; x<intTotal; x++){

System.out.println("...asoiajdofjasd");

}

How to do this?!

Thanx!

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Mixing the answers, I can do this...

Thank's!

Former Member
0 Kudos

hi,

if u have the following context structure,

value node :L1

L1 has a value node :L2.

L2 has a value attributes a1,a2.

to get the size of L2.

wdContext.nodeL2().size(); is possible.

We need not use L1 to navigate to L2.

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

{

wdContext.nodeL2().getElementAt(i);

}

Regards

Alamelu

Former Member
0 Kudos

Do you mean how to iterate over all elements inside a context node? I think this should be obvious by reading the API Javadoc.


for (int i = 0; i < wdContext.nodeXYZ().size(); ++i)
{
  IXYZElement e = wdContext.nodeXYZ().getXYZElementAt(i);
  /* do something with node element */
}

Armin

Former Member
0 Kudos

So...

And to access a subnode?!

For example:


wdContext.nodeXYZ().otherSubNode().otherSubSubnode().size

I can't find this methods inside my context...

My context is something like this:

-nodeXYZ

--contextSub

---contextSubSub

-


Field01

-


Field02

-


Field(...)

I need to capture this fields...

Thank's a lot...

😃

Former Member
0 Kudos

That depends. If you have the following structure


XYZ (node)
-- Child (node, singleton=false)
---- text (string)

then you can iterate like this:


for (int i = 0; i < wdContext.nodeXYZ().size(); ++i)
{
  IXYZElement e = wdContext.nodeXYZ().getXYZElementAt(i);
  for (int j = 0; j < e.nodeChild().size(); ++j)
  {
    IChildElement child = e.nodeChild().getChildElementAt(j);
    String text = child.getText();
  }
}

Armin

Former Member
0 Kudos

You can use the keyword 'for' instead of 'while'.....it will serve the same purpose...

Regards,

Shikhil