cancel
Showing results for 
Search instead for 
Did you mean: 

How to use EVS with different data in each row, in a Java Web Dynpro table?

Former Member
0 Kudos

Hi all,

I am using EVS in a column of java web dynpro table.

Let's say the name, and context attribute, of this column is column1.

It's filled dynamically using an RFC, that uses as input parameter the value of another column, and related context attribute, from the same table (Let's call it column2).  Obviously, from the same row. So, in other words: the values of the EVS in column1 of row1, are dependent of the value of column2 of row1. And the values of the EVS in column1 of row2, are dependent of the value of column2 of row2. And so on... Hope i could explain myself ok.

The code I'm using works great for filling the EVS dynamically:


IWDAttributeInfo attrInfo = wdContext.nodeDetail().getNodeInfo().getAttribute(nodeElement.COLUMN1);

ISimpleTypeModifiable siType = attrInfo.getModifiableSimpleType();

IModifiableSimpleValueSet<String> value = siType.getSVServices().getModifiableSimpleValueSet();

value.clear();

if(this.initRFC_Input(nodeElement.getColumn2())){

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

          value.put(wdContext.nodeRFCresult().getRFCresultElementAt(i).getLgort()

             , wdContext.nodeRFCresult().getRFCresultElementAt(i).getLgobe());

     }

}

In this code, nodeElement is the context row of the table that is passed dynamically to the method when the value of colum2 is changed.

HOWEVER, the problem I'm having is that after executing this code, EACH NEW ROW that is added to the table has by default the same values as the first row, in the column1 EVS. And, for example, if I refresh the values of the column1 EVS in row 2, all EVS values in the other rows are also refreshed with the same values as the ones of EVS in row 2.

How can I make sure each row EVS has its own set of independent values, so they don't mess with each other?

Hope you guys can help me. And please, let me know if I didn't explain myself correctly!

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

govardan_raj
Contributor
0 Kudos

hi Alain ,

The problem is you are setting EVS to the attribute of the node

IWDAttributeInfo attrInfo = wdContext.nodeDetail().getNodeInfo().getAttribute(nodeElement.COLUMN1);

i.e COLUMN1 Which in turn is binded to all the rows in the table, and each row can have a different value for this COLUMN1 attribute , but for EVS in the above line of code attrinfo  is to the attribute of the node and not each attribute of the individual  NodeElement .

hope you could understand

but there is solution for this , where you can create child node of name xxxColum1values() in the table node that is binded to the table , and cardinality of this child node is 0..n and it is singleton property is false , so that for each element of the table there exists a seperate child node xxxColumn1values() filled with different values , i.e in the above code you can fill data to this child node

ipublic*****.ixxxColum1valuesElement = childNodeElement;

for (int i = 0; i < wdContext.nodeRFCresult().size(); i++)
  { 
     childNodeElement = nodeElement.xxxColumn1Values().createxxxColumn1ValuesElement;
         childNodeElement.set();
   nodeElement.xxxColumn1Values().add(childNodeElement);

  
     }

Regards

Govardan Raj S

Former Member
0 Kudos

Hi Govardan,

Thanks for your reply.

I understand the logic to create and fill the child nodes, in the example that you put. And now, I'm actually able to fill independent sets of data for each row, but only using DropdownByindex. Using DropdownByIndex, I'm able to show the correct list of values for each row, depending on the value of COLUMN2...

But I need to show them in an EVS in each row, not a DropdownByIndex. How can i do that? i think the key for this is knowing what to put in the following line to start rendenring the EVS:

IWDAttributeInfo attrInfo = ????

Really appreciate your help!

govardan_raj
Contributor
0 Kudos

answer is there at your description above ,  just create non singletone node with cardinality as 1..1 and in that have an attribute , and for this attribute you create evs and fill the data when ever data is chaging in column2, bind this attribute to the evs column , this will solve your problem

iwdattributeinfo = attrinfo = nodeElement.xxxColumn1value().getnodeinfo().getattribute(..);

Regards

Govardan Raj S

Former Member
0 Kudos

I just did as you said (I think), but it's still having the same behaviour as before (same data for all EVS in the table).

Here´s what I did:

I

  • In node "Detail" (cardinality 0...n, singleton set to true), which is binded to the table, I created a child node named "Column1Values" wth cardinality 1...1 and singleton set to false.
  • "Column1Values" node has an attribute called "column1", of type String.
  • I did the binding between attribute "column1" and the column1 inputfield celleditor in the table.
  • I created an event called Column2Changed and binded it to the column2 celleditor of the table. I added a parameter called nodeElement of type IPrivateCompView.IDetailElement to this event, and mapped it to the column2 editor in the table so that I can dynamically get the nodeElement that is being affected.
  • I added the following code to the onActionColumn2Changed(wdEvent, nodeElement) method that gets created in the view:


IWDAttributeInfo attrInfo = nodeElement.nodeColumn1Values().getNodeInfo().getAttribute("column1");

ISimpleTypeModifiable siType = attrInfo.getModifiableSimpleType();

IModifiableSimpleValueSet<String> value = siType.getSVServices().getModifiableSimpleValueSet();

if(this.initRFC_Input(nodeElement.getColumn2())){

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

          value.put(wdContext.nodeRFCresults().getRFCresultsElementAt(i).getId(),

                              wdContext.nodeRFCresults().getRFCresultsElementAt(i).getDesc());

     }

}

And with this, I still get the original problem... When the EVS of one row is updated, ALL other EVS of the table get also updated with the same values.

What am I missing? Sorry Govardan, I bet I'm not seeing something really obvious... hopefully you can point me in the right direction.

Thanks!

govardan_raj
Contributor
0 Kudos

hi alain ,

Even i tried same replicating your example with test dcs , but went in vain the evs is filled with the values that are meant for the last element of the table i.e last row ,here framework is taking reference of the attribute alone .so evs of all the Rows of the table will be filled with values colum2 that you are selecting currently.

one way is to use DropDownByIndex , but in your case if the values are more than 30 then DDI is not suitable one.

Regards

Govardan Raj

Former Member
0 Kudos

Yeah, it does work with DropdownByindex, but there are cases where I can have a couple hundred registries thus making DropDownbyIndex not viable...

Oh well, thanks for your help Govardan

I guess it's back to the drawing board, and replace these EVS in the table with something else... unless someone can point me what am I missing?

Cheers

Answers (1)

Answers (1)

Former Member
0 Kudos

So, does anyone have an idea for achieving this? i stil haven't figured it out without using popups and temporary nodes...