cancel
Showing results for 
Search instead for 
Did you mean: 

urgent******how can i get the number of rows enterd by the user in a table

Former Member
0 Kudos

Hi Frndz..

As per my requirement i need to do the validations for the multipple rows in a table that was enterd by the user,

T

The prob is how can i get that number of rows that enterd by user,

WDMessageManager msg = wdComponentAPI.getMessageManager();

String col1= "";

String col2= "";

double col3= 0;

double col4= 0;

double amount= 0;

int nodesize = wdContext.nodeTest().size();

try

{

for(int i=0; i<=2 ; i++)

{

col1 = wdContext.nodeTest().getTestElementAt(i).getCol1();

//msg.reportSuccess("col1 size is :"+col1);

col2 = wdContext.nodeTest().getTestElementAt(i).getCol2();

col3 = wdContext.nodeTest().getTestElementAt(i).getCol3();

col4 = wdContext.nodeTest().getTestElementAt(i).getCol4();

amount = wdContext.nodeTest().getTestElementAt(i).getAmount();

if(col1 == "" )

{

msg.reportException("Plz fil the col1 for line:",true);

break;

}

else

if(col2 == "" )

{

msg.reportException("Plz fil the col2 for line:",true);

break;

}

else

if(col3 <= 0)

{

msg.reportException("Plz fil the col3:",true);

break;

}

else

{

if(col4 <= 0)

{

msg.reportException("Plz fil the col4:",true);

break;

}

}

msg.reportSuccess("skvgjhdfgasdfgsjkafguisafisenvtvyeriy");

wdThis.test();

}

}

catch (Exception e)

{

msg.reportException("strMessage in catch block",true);

}

this is the code am going

Regards

Rajesh

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

You can try this:


/**
 * Let's say the table's datasource is a node called Table  and it has two attributes first & second.
 * You want to check if any of these attributes has been changed by the user or not. If they have been
 * changed then you want to do some validations against them.
 */
  int sizeOfTable = wdContext.nodeTable().size();
      
  for(int i = 0; i < sizeOfTable; i++){
     IPrivate<view name>.ITableElement ele = wdContext.nodeTable().getTableElementAt(i);

     if(ele.isChangedByClient(ITableElement.<attribute name>)){
        //value has been changed, do some validation. You can get the row index using ele.index().
     }
  }

Regards,

Satyajit.

Former Member
0 Kudos

Hi,

You can get the number of rows by the size of the node that you bind to the table.

Kind Regards

Saravanan K

sid_sunny
Contributor
0 Kudos

Hi Rajesh,

Check the size of the node to which the table is binded.

Regards

Sid