Skip to Content
author's profile photo Former Member
Former Member

help with output in a WebDynpro CO...

hi all,

I have the following problem, I suppose that follows output of a CO

- *Structure1*

-- Attribute1

-- Attribute2

-- SubStructure1

--- Attribute3

...

Structure1 corresponds to a table with 3 rows. The SubStructure corresponds to a DropDownbyIndex this within the table.

I try this

IGPStructure output = executionContext.getOutputStructure();

IGPStructure Structure1 = output.addStructure("Structure1");
           
 Structure1.setAttributeValue("Attribute1", 
   wdContext.currentContextElement().getAttribute1());

 Structure1.setAttributeValue("Attribute2", 
   wdContext.currentContextElement().getAttribute2());

IGPStructure SubStructure1 = Structure1.addStructure("SubStructure1");

 SubStructure1 .setAttributeValue("Attribute3", 
   wdContext.currentContextElement().getAttribute3());
...

but only showed me the last row, What can I do?

thanks

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 19, 2009 at 05:58 AM

    Hi,

    From your code it is clear that you are adding only one element.For adding all the three elements

    you need to iterate and add all the three elements.

    IGPStructure output = executionContext.getOutputStructure();

    for(int i=o;i<3;i++){

    IGPStructure Structure1 = output.addStructure("Structure1");

    Structure1.setAttributeValue("Attribute1",

    wdContext.nodeXYZ().getElementAt(i).getAttribute1());

    Structure1.setAttributeValue("Attribute2",

    wdContext.nodeXYZ().getElementAt(i).getAttribute2());

    IGPStructure SubStructure1 = Structure1.addStructure("SubStructure1");

    SubStructure1 .setAttributeValue("Attribute3",

    wdContext.nodeABC().getElementAt(i).getAttribute3());

    }

    ...

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 24, 2009 at 07:16 PM

    try this:

    IGPStructure output = executionContext.getOutputStructure();
    for(int i=1; i<=wdContext.nodeTabla_traspasos().size();i++)
    {
     IGPStructure tabla_traspasos = output.addStructure("myTable");
     tabla_traspasos.setAttributeValue("cc_emisor",wdContext.nodeTabla_traspasos()
      .getMyTableElementAt(i).getCc_emisor());
    }
    

    but showed me this error

    java.lang.IndexOutOfBoundsException: Index: 2, Size: 2

    Why is that?

    thanks

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      IGPStructure output = executionContext.getOutputStructure();

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

      {

      IGPStructure tabla_traspasos = output.addStructure("myTable");

      tabla_traspasos.setAttributeValue("cc_emisor",wdContext.nodeTabla_traspasos()

      .getMyTableElementAt(i).getCc_emisor());

      }

      Index starts with 0 but not 1.Thats the reason you are getting index out of bound exception.

      so start with i=0 and iterate upto i<wdContext.nodeTabla_traspasos().size() as shown in the above code.

      Regards,

      Sudhir

  • author's profile photo Former Member
    Former Member
    Posted on Feb 26, 2009 at 01:11 PM

    Thanks for your answers, but this was my error:

    IGPStructureInfo tabla_traspasos = output.addStructure("Tabla_Traspasos");

    tabla_traspasos.setMultiplicity(IGPStructureInfo. MULITIPLICITY_0_1 );

    the solution

    IGPStructureInfo tabla_traspasos = output.addStructure("Tabla_Traspasos");

    tabla_traspasos.setMultiplicity(IGPStructureInfo. MULITIPLICITY_0_N );

    thanks

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.