NetTalk Central

Author Topic: Web services and Page Load  (Read 4309 times)

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Web services and Page Load
« on: May 23, 2018, 01:46:06 AM »
Hi,

I know that the Clarion templates implement a page-loading strategy whereby only portions of a table's records are loaded - and the list box allows the user to seamlessly scroll up and down without knowing that there are constant calls in the back to load the next page of data.

Are there any suggestions available how to approach this same strategy with web services? I have done some work already, but it seems clumsy and would like to consider other options.

Thanks
Thys
 

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Web services and Page Load
« Reply #1 on: May 23, 2018, 11:22:00 PM »
Hi Thys,

by "web services" do you mean WebServiceMethods getting "pages of data"?
or are you talking about web apps?

Perhaps a bit more context will help answer the question...

cheers
Bruce


Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Re: Web services and Page Load
« Reply #2 on: May 23, 2018, 11:33:24 PM »
Hi Bruce.

It is for web service methods. For example, a procedure "dbTransaction" may service calls on the Transaction table of a database. This table potentially contains millions of records. So the procedure should be coded such that there is always a filter that is applied, in order not to return huge blocks of data in one response. In the absence of a filter, where the client requires (for example) the first "set" of transactions to be returned in date order, the procedure could use a paging methodology whereby only the first (say) 100 records are returned. And similar to the next/previous arrows below a grid on a web page, the client can request a next page of data.

I think that Clarion's SQL driver creates temporary stored procedures to serve the data in pages by default. This may be neat if NT can do the same for web services :) but it might be difficult. The way that I've started using, is to add extra parameters to my dbTransaction procedure to indicate from where a page must be loaded, and the number of records to be returned.

So my question  is whether there are other ways to allow pages of data to be returned.

Thys

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Web services and Page Load
« Reply #3 on: May 24, 2018, 12:47:13 AM »
Hi Thys,

I'm not aware of any SQL Stored procedures, but paging in general (for a NetWebBrowse) is complicated.
It's made more complicated by the fact that in the web (Browse or service methods) it spans multiple threads -
it's not like an ABC browse which all works on a single thread.

Obviously there is a paging system built-in for the Browse template, and that works well. Presumably that could be extended to work with Service Methods as well.

But I'm not sure if that's the correct approach.
If you have a date/time stamp on your rows, then it's possible to filter based on that. For example, say the server is only set up to deliver 100 records at a time. Then I get the first 100 records. I look at the last record (time stamp) and ask for the next 100 after that, and so on.

You could do this with any key, it doesn't have to be a timestamp, but hopefully you get the idea?

cheers
Bruce