Tiago Martins
Posts: 0
Joined: Fri Sep 05, 2014 12:41 am

generic custom implementation service, retrieve records from database, limit

Hello,
I have this generic service (custom javscript implementation) to retrieve data from websql. It only retrieve 100 results, how can I add limit parameter to retrieve more records?:

Appery.jsWEBSQL = Appery.createClass(null, {

Code: Select all

 init : function(requestOptions) { 
     this.__requestOptions = $.extend({}, requestOptions); 
 }, 

 process : function(settings) { 
     //settings.beforeSend(settings); 
     if (this.__requestOptions.echo) { 

         settings.success(this.__requestOptions.echo); 
     } else { 
  var ourFinalArray = []; 

         db.transaction(function(tx) { 

             var sql = "select ... "; 

             tx.executeSql(sql, [], function(tx, results) {             
   var len = results.rows.length, i; 
                 if (len === 0) { 
                     console.log("no records"); 
                 } else { 
                     for (i = 0; i < len; i++) { // for each row 
                         ourFinalArray.push(results.rows.item(i)); // pushing row object to an array                 
                     } 
                     settings.success(ourFinalArray);        
                 } 
                 settings.complete('success'); 
             }); 

         });             
         settings.success({}); 
     } 
     settings.complete('success'); 
 } 

});

Thank your for your help.
BR

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

generic custom implementation service, retrieve records from database, limit

Hello,

Please clarify, do tou use SQL parameter "limit"? I don't see your SQL query here.

Tiago Martins
Posts: 0
Joined: Fri Sep 05, 2014 12:41 am

generic custom implementation service, retrieve records from database, limit

No, how can I use it? My sql query is the sql var/string. It is incomplete, something like " select * from table".

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

generic custom implementation service, retrieve records from database, limit

If you don't use "limit", you get all items from the database. Be sure there are more, than 100 items.

Tiago Martins
Posts: 0
Joined: Fri Sep 05, 2014 12:41 am

generic custom implementation service, retrieve records from database, limit

This is the service that use a generic javascript implementation. How do I add limit parameter?
Image

Tiago Martins
Posts: 0
Joined: Fri Sep 05, 2014 12:41 am

generic custom implementation service, retrieve records from database, limit

no, I'm not using limit (even i don't know how to define it in a js implementation), I think that's why it returns only 100 records. no?

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

generic custom implementation service, retrieve records from database, limit

I meant SQL "limit" clause. Also, you can check the length of the database request with prealert(results&#46;rows&#46;length);/pre

We are very sorry, but we can't debug your custom code - this is something outside the scope (http://devcenter.appery.io/support-po...) of our standard support.

Tiago Martins
Posts: 0
Joined: Fri Sep 05, 2014 12:41 am

generic custom implementation service, retrieve records from database, limit

I know, I'm not asking you to debug my code. I already check that my code returns more than 100 records, but only display 100 records when mapping this to grid or list.

How can I define limit parameter in a Javascript service?

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

generic custom implementation service, retrieve records from database, limit

Please show us the screenshot of the mapping of that service. Also, please check the length of the variable, which you use in that mapping.

Return to “Issues”