How can I count specific values from a DB to show them in the app? I need to check in my DB if some value is 'yes' or 'not' and them show in the app the total number of values that are equals to yes and the ones that are not.
How can I count specific values from a DB to show them in the app? I need to check in my DB if some value is 'yes' or 'not' and them show in the app the total number of values that are equals to yes and the ones that are not.
Hi Miguel,
You can use this this goal "list/query" service with certain "where" and "count" parameters.
See details about "where" parameter:
http://devcenter.appery.io/documentat...
See details about "count" parameter:
http://devcenter.appery.io/documentat...
Regards.
(I have the same question)
I understand that you can use these parameters but how do you return the count to a local storage variable or to a label so that it can be used in the app?
Hi Russ,
When creating a mapping, you should specify where to save a result.
You can either save it in a component (in your case it is a label), or in a local storage variable (then you should create this variable in 'model and storage' section beforehand).
I have tried to specify where to save the result but I can not seem to find where to do that. I have uploaded pictures. The first one is of the before send on the query where I can specify the count. The second one is the mapping of the success but there is not an option to map the count to anything.
Hi Russ,
To get count of returned service items you can:
1 Add "Success" event handler for service.
2 Populate it with following code:
pre
//Get items count.
var count = data[0].count;
//Save count to LSV.
localStorage.setItem("lsvName", count);
/pre
After you can get "lsvName" lsv where you need with following code:
pre
var count = localStorage.setItem("lsvName", count);
alert(count);
/pre
Regards
I tried doing what you have suggested but for some reason when I add the count parameter my queries stop working. It messes up all of my other queries that were previously working. Once I remove the count parameter the other queries begin to work again.
Hi Russ,
"Count" service should be implemented as separate service.
So:
1 Delete "count" parameter from the service.
2 Duplicate this service. http://prntscr.com/4xukgb/direct
3 Rename new(clone) service as you need.
4 Open this service and add "count" parameter.
5 Use this new service where you need to get count.
6 Use old service where you need to get list.
Regards.