Hi Kateryna,
I used the following:
codereturn '{"$and":[{"UserId": "' + value + '"},{"Month_Year": "' + Apperyio.storage.Month_Year.get() + '"}]}';/code
where I mapped only UserId to Where condition and added the above JS to where. The results I get are all zeros.
To clairfy more, where condition is on map request. On success, I run the following JS to calculate the totals and display them on corresponding label:
codefunction numberWithCommas(x) {
var parts = x.toString().split(".");
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
return parts.join(".");
}
var vis = 0; var int = 0; var net = 0; var bon = 0;var petm = 0; var pcf = 0;
for (var i=0; i<data.length; i++) {
vis+=+data.MPD_Visibility;
int+=+data.MPD_Interact;
net+=+data.MPD_Sales;
bon+=+data.MPD_Bonus;
petm+=+data.MPD_Points_Month;
pcf+=+data.MPD_Points_Carried_Forward;
}
vis = numberWithCommas(vis);
int = numberWithCommas(int);
net = numberWithCommas(net);
bon = numberWithCommas(bon);
petm = numberWithCommas(petm);
pcf = numberWithCommas(pcf);
Appery("mobilelabel_124_130").text(vis);
Appery("mobilelabel_152").text(int);
Appery("mobilelabel_154").text(net);
Appery("mobilelabel_156").text(bon);
Appery("mobilelabel_162").text(petm);
Appery("mobilelabel_161").text(pcf);/code
This without adding a second condition to where (mean when I use only UserId: return '{"UserId": "' + value + '"}';), everthing is working fine. However, it will return the totals regardless the month. So all what I need to add, is to show the result based on the month chosen. The month value is passed via radio button to the LSV : Month_Year. And there is a column in the DB table called MPD_Month.
I hope it's clear. Many thanks for your help