Skip to Content
avatar image
Former Member

How to iterate over all elements of a node?

Hi all,

I've a of MyElements and bind it to MyNode. Now I want to iterator over all bounded elements. Is it possible and when how?

Jürgen

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Aug 26, 2004 at 10:11 AM

    Hi Jürgen,

    please have a look at the IWDNode API:

      /**
       * Returns the element at the given index.
       * @param index the index of the element
       * @return the element at the given index
       * @throws IndexOutOfBoundsException if the node does not have such an element.
       */
      IWDNodeElement getElementAt(int index);
    
      /**
       * Returns the size of the element list.
       * @return the size of the element list
       */
      int size();
    
      /* so you can do something like: */
      for (int ix = 0; ix < wdContext.node<NodeName>().size(); ix++) {
        // For a view controller
        IPrivate<ViewName>.I<NodeName>Element el = wdContext.node<NodeName>.get<NodeName>ElementAt(ix);
        // For non view controller
        IPublic<CtrlName>.I<NodeName>Element el = wdContext.node<NodeName>.get<NodeName>ElementAt(ix);
      }

    Hope that helps.

    Regards

    Stefan

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 26, 2004 at 10:36 AM

    I got it:

    int anzahlIstzahlen = wdContext.nodeIstzahl().size();

    for (int i = 0; i < anzahlIstzahlen; i++) {

    IPrivateMonatsabschlussView.IIstzahlElement istzahl = wdContext.nodeIstzahl().getIstzahlElementAt(i);

    istzahl.setAbzurechnen(true);

    }

    Add comment
    10|10000 characters needed characters exceeded