NetTalk Central

Author Topic: Adding Total Rows and Page Number to a Paged Browse  (Read 18729 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Adding Total Rows and Page Number to a Paged Browse
« on: November 28, 2008, 09:20:59 AM »
Hi all,
May be its obviuos but it took me time to get it working.
If you have a Browse paged and want to show the total rows and the page number the user are seeing, you can use these enbeds to achieve this.

DATA
define two variables to hold the values, lets say
  loc:TotalRows   and   loc:ActualPage

CODE
  ! At Start of "After SetView"
  ! [Priority 5000]
  direction# = loc:direction
  !to remenber the browse buttons action

  ! At Start of "After Browse Before Buttons"
  ! [Priority 5000]
  !--------------------------------------------------------------------------------------------------------------------------------------
  loc:TotalRows = !here you need to provide total of rows,
  !if the browse are not filtered and you are using TPS then it may be just RECORDS(YourTable)
  !if you are using SQL the you can do a SELECT COUNT(*)...
  !--------------------------------------------------------------------------------------------------------------------------------------
  LOC:ActualPage=p_web.GetSessionValue('LOC:ActualPage')
  case direction#
  of 1
     LOC:ActualPage = 1
  of -2
     LOC:ActualPage -= 1
  of 2
     LOC:ActualPage += 1
  of -1
     LOC:ActualPage = loc:TotalRows/loc:pagerows
  end
  IF LOC:ActualPage<1 THEN LOC:ActualPage=1.
  p_web.SetSessionValue('LOC:ActualPage',LOC:ActualPage)
  packet = clip(packet) & |
    '<<table><13,10>'&|
    ' <<tr><13,10>'&|
    '  <<td>Total rows: <<!-- Net:s:loc:TotalRows --><</td><13,10>'&|
    '  <<td>Page: <<!-- Net:s:loc:ActualPage --><</td><13,10>'&|
    ' <</tr><13,10>'&|
    '<</table><13,10>'&|
    ''
  do SendPacket

And thats all...

Bruce: May be a good idea for a NetBrowse template new tab... Totaling
Defining the variable containing the Total rows, the one for the page,an embed to do the calc and a text to add the XHTML to display them.

It is very usefull with big browses for the user to know at where page are they looking at.

Just my 2 cents, I hope it will be usefull.

Alberto
-----------
Regards
Alberto

charl99

  • Full Member
  • ***
  • Posts: 185
    • View Profile
    • Email
Re: Adding Total Rows and Page Number to a Paged Browse
« Reply #1 on: December 10, 2008, 04:40:44 AM »
Alberto,

Quite handy thanks, I find you have to set the session value for loc:TotalRows as well.

Have you found a solution if somebody use the locator button,considering large tables will have a 'Page' Loading method you cannot just use pointer(TableQueue), I think?

Charl

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Adding Total Rows and Page Number to a Paged Browse
« Reply #2 on: December 10, 2008, 04:56:40 AM »
Good idea!, I will try with a locator ASAP.
-----------
Regards
Alberto