I read on another question a few months ago that you are unable to access the Counter Value.
I honestly do not think you understand what I am asking. In my image above, you have a Counter value, that you can populate with a response from a data query. But, as I cannot do a query within a query, I need to do another query while its populating each listItem.
So I wanted to fill the Current Value with the result to the second query. That is not a service, as I cannot do two services at once 
This is the work around, but I cannot get the listview as tidy as I can using a sevice.
precode
$.ajax({
type: 'GET',
beforeSend: function(request) {
request.setRequestHeader('X-Appery-Database-Id', '53088********1c8cd3d');
},
url: 'https://api.appery.io/rest/1/db/collections/groups/',
dataType: 'json',
data: {
where: '{"user_id" : "' + getVar('user_id') + '"}',
sort: 'group_name'
},
success: function(qcllist) {
$.each(qcllist, function(cn,cv) {
//count statements from last login date
var gn = cv.group_name;
var gt = cv.group_type;
//console.log(gt);
$.ajax({
type: 'GET',
beforeSend: function(request) {
request.setRequestHeader('X-Appery-Database-Id', '5308*************c8cd3d');
},
url: 'https://api.appery.io/rest/1/db/collections/statements',
dataType: 'json',
data: {
where: '{"$and" : [{"group_name": "'+cv.group_name+'"}, {"group_type" : "'+cv.group_type+'"}, {"_createdAt" : {"$gt" : {"$date" : "'+getVar('lastLoggedIn')+'"}}}]}',
count: "1"
},
success: function(res) {
var col,fcol;
if(res[0].count > 0) {
col = "red"
fcol = "white"
} else {
col = "white"
}
Code: Select all
//console.log(res);
$('#groupsListView').append('<li class="section_screen_mobilelistitem_9 ui-btn-icon-right ui-icon-carat-r ui-li-static ui-body-inherit ui-li-has-count ui-btn-up-a ui-last-child"><a id="groupClick" ref="'+gn+'" name="'+gt+'" href="#"><div class="ui-li-static-container">'+gn+'<span class="ui-li-count" style="background-color:'+col+' !important; color:'+fcol+'">'+res[0].count+'</span><br><small>'+gt+'</small><></a></li>');
}
});
});
}
});
/code/pre
All I wanted to know, is how do you populate the Counter Value box within a Javascript Function, rather than a Service Response.