cancel
Showing results for 
Search instead for 
Did you mean: 

Select a specific Row by its Index in IWDTable

Former Member
0 Kudos

Hi Friends,

I am writing an WDJ and WDA appliction where I have a need to select a specific row in IWDTable dynamically i.e. a method runs at runtime at gives me the index of the Row to be selected e.g the 3 row of the Table. I put that index in the Context in an Attribut. The Data in the Table is coming per RFC.

Any ideas may be how can I achieve that?

Best Wishes,

Farhan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ayyapparaj,

When i execute the Bapi i get 250 records which are automatically filled in the IWDTable through context mapping. But later when the Table is already filled then i want to select the 3rd Row.

farhan

Former Member
0 Kudos

Hi,

If you try as follows does it work?

wdContext.node<YourNode>().setLeadSelection(3);

Regards

Ayyapparaj

Answers (5)

Answers (5)

Former Member
0 Kudos

Thanx Ayyaparaj Problem Solved.

Gr8

Former Member
0 Kudos

thanx for the quick response. I was trying out your suggestions but I am getting following exception.

java.lang.IndexOutOfBoundsException: Node(VarTestingComp/VarTestingComp.Z_Fash_Getguvs_Input.Output, class=com.vartestingcomp.wdp.IPublicVarTestingComp$IOutputNode): index out of bounds: index=3, size=1

On seeing the exception I have changed the Collection and Selection Cardinality of the Context to 0..n both.

Here is the Code-Snippet

	 
 //parameter 1
 int konfidenzlevel = wdContext.currentVaR_ParamElement().getKonfidenz();
//parameter 2
int records = wdContext.currentVaR_ParamElement().getStichprobe();
// returns the Index most of the time remains 3: 3rd row in Table
int VaRindex = (int)java.lang.Math.floor((1-(konfidenzlevel*1.0/100))*records) + 1;
// Now should the VaRindex-th Row should be selected.
wdContext.nodeOutput().setLeadSelection(VaRindex);

thx for the consideration.

farhan

Former Member
0 Kudos

Hi,

index out of bounds: index=3, size=1

It seems you are trying to set the leadselection for a node which doesnt have that much elements.

Pl make sure that the index for the leadselection should be less than the maximum number of elements

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

use


//Accessing the attribute that contains the index
int x = wdContext.currentContextElement().getIndexToSelect();
//assign this index to get the lead selection
wdContext.node<YourNode>().setLeadSelection(x);

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

If the 3 row has to be selected in the table, just set the lead selection.

if the context node mapped to table id : tableDate

your code will look some thing like

wdContext.nodeTableData().setLeadSelection(3);

Hope it helps.

Former Member
0 Kudos

Hi,

In order to get the current row u need to perform getleadSelection on ur node which is bound to that table.

like


wdContext.nodeRFCNODE().getLeadSelection();

It starts from 0 like if ur first row is selected it will return 0;

Regards

Surender Dahiya