I am trying to do something similar to this thread. https://getsatisfaction.com/apperyio/...
The differences are that I'm doing a count of all records that match the "id" from the "Properties" collection to the "PropID" column of the "Comments" collection and that match "pro" in the "ProCon" column of the "Comments" collection. and mapping the "count" to a label in the list that matches the "id". And then repeat the process again to count "con" in the "ProCon" column.
here is the flow:
on page load: Invoke service "GetProperties" a list service
On service success: Mapping
topic m
in the mapping I have the _id mapped to a invisible label in the listitem and added JS to the mapping
I used the JS from the thread mentioned above but I dont understand it enough to make it work. but here is what I got so far.
codefunction successFunction (data){
console.log(data);
if (data.length >0) {
$(element).closest("li").find("[dsid=PropIDLabel]").text(data[0].Body);
Code: Select all
}
}
ProsCount.execute({
data: {
"where": '{"PropID":"'+ value +'","ProCon": "pro"}'
},
success: function(data) {
successFunction(data);
}
});
return value;/code
Here is the mapping for the "CountPros" service.
I'm not sure if I need to map the count service or not. It does not change the results of my test.
When I test the app and the page loads here is what the console log shows
Here is the network, it is executing the service with the id of each property in the list.
but the response is missing.
I'm not sure but I think my query syntax is wrong in the JS. (note: I use the exact same query in another part of my app without a problem, it is only when I try this list combination that it gets not response.)
Thank you for the help.