cancel
Showing results for 
Search instead for 
Did you mean: 

how to check the number of rows in a table with input data?`

Former Member
0 Kudos

Dear all,

I am having a table ( with declaration of 5 rows during the init ) there's a next button which will add another 5 rows by pressing. Let say the user ony key in 7 rows of data.. how should i track it? coz these data act as input to my bapi function. One of the input field of my bapi is to state how many rows of data that a user had key in. Thank you.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

wdContext.nodeYourNodeName().size(); will return no of rows

Regards

Abhijith YS

Former Member
0 Kudos

hi all,thx for the fast reply. but at the init do there i haf the following declaration

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

IPrivateWoInvNum.ITableElement tab =

wdContext.nodeTable().createTableElement();

wdContext.nodeTable().addElement(tab);

}

so it means no matter wat,the row size is set to 5..but i wish to check the exact number of records..coz user might juz key in 1 row or up to 3 rows... any ideas? thanks

Former Member
0 Kudos

Hi,

Before executing the bapi see the size of the node.

Ex based on your code:

int size = wdContext.nodeTable().size();

This will return you the no of elements in the table if you have binded the table with nodeTable

Regards

Ayyapparaj

Former Member
0 Kudos

I think ur problem is empty records, u dont want to process empty table rows.

m I right?

if yes then just before processing the data / records, check for empty records and remove unwanted rows from the node.

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

{

if all cells of row(i) are empty

remove row(i) from Table Node.

}

OR if you dont want to remove empty rows from display (screen), then at the time of processing, transfer useful rows to a separate node and process that node.

Best Regards

Deepak

Former Member
0 Kudos

Hi Joan,

You have intially added 5 rows to the table in WDDoInit() method but whenever you keep on appending the rows to the table(ie. whenever a nodeElement is added to the node), the wdContext.nodeTable().size() will give you the number of rows at that stage of time.

Assume 5 rows are added intially and on click on some button you added 2 more rows . Now say there is a button called count which calculates the number of the rows in your table. So you can read the size of your node on the action binded to the button count

wdComponentAPI.getMessageManager().reportSuccess(wdContext.nodeTable().size()+"");

Regards,

Murtuza

Former Member
0 Kudos

Hi Joan,

You might have binded a node as a datasource for your table. You can get the number of rows in your table by reading the size of the node.

Assume, the name of your node is Table()

int size = wdContext.nodeTable().size();

Warm Regards,

Murtuza