Getting the last row of grid in k2

  • 30 September 2021
  • 2 replies
  • 35 views

Badge +8

Hi,

 

I have a list of record(s) in grid. When user click the add button a new blank row appears at the button of the grid. I should be able to copy the last row and automatically paste on the blank row.

How can I read the last row of the grid?

 

Thanks 🙂


2 replies

Hi,


 


If you are reffering to a list view then this should work:


1. You can use a stored proc to get the last row ID and return it into a datalabel/parameter and copy the data you need from the last row. 


2. If you cannot use a stored proc, you can create another table/SmartObject, store the last created ID in the table and update the value each time a new row is created. You can the use that ID to read the previous row's data.


 


Let me know if this doesnt make sense. 

If you are reffering to a list view, you can simple create am expression and use the function "count" to check number of rows in the list and then filter the list with execute a view method and filter it with the expression count which would be equal to the last row number. 


 


Cheers

Reply