How do I process only the visible rows of a table?

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

Hovik
Moderator
Moderator
Posts: 184
Joined: Tue Sep 11, 2007 8:58 am

How do I process only the visible rows of a table?

#1

Postby Hovik » Mon Nov 19, 2007 7:17 pm

My table may contain hundreds of rows, but only 8 are visible at any time.
When the user clicks a button on the page where the table is displayed, I want to process only the rows which are visible.
0 x

Hovik
Moderator
Moderator
Posts: 184
Joined: Tue Sep 11, 2007 8:58 am

#2

Postby Hovik » Mon Nov 19, 2007 7:25 pm

This is possible, provided that there is a way of uniquely identifying a row, using one or more cells of that row. For example, there is a column called SEQ_ID, which contains a unique value for each row.
  • Add a field to the form, of the same type as the key field, say CURRENT_SEQ_ID.
    Add a field to the form, type integer, called CNTR.
    Attach the following script to the button (assuming your table is called T1, and the unique column is called SEQ_ID):

Code: Select all

set CURRENT_SEQ_ID = T1-SEQ_ID;    // Remember the SEQ_ID of the 1st visible row
set CNTR = 0;

loop at table T1
   if [CURRENT_SEQ_ID = T1-SEQ_ID]
      set CNTR = 1;
   endif
   if [CNTR > 0]
      if &#91;CNTR < 9&#93;
         // logic to process the current row
         set CNTR = CNTR + 1;
      else
         break;
      endif
   endif
endloop
0 x

brianb
Ebase User
Posts: 1
Joined: Fri Apr 11, 2008 1:30 pm

On Scroll event

#3

Postby brianb » Fri Apr 25, 2008 9:12 am

:?: OK, but is it possible to do this automatically as the user scrolls.
I have found a reference in the documentation to 'table internal events', but can't see where I can attach a script to them.
0 x

User avatar
Wai
Moderator
Moderator
Posts: 165
Joined: Wed Sep 12, 2007 9:04 am
Location: Sandy, UK
Contact:

#4

Postby Wai » Wed Apr 30, 2008 10:43 am

From the documentation:

User requests to sort, scroll or add a row are treated as table internal events. When one of these events occurs, all data is first validated by running the appropriate field validation event scripts if any have been specified.


So, any scripts you would like to run needs to be on the table field's validation event.
0 x


Who is online

Users browsing this forum: No registered users and 44 guests