Page 2 of 2

Filter data that is in an array

Posted: Thu Aug 18, 2016 6:05 am
by Robert Lamb

Deon,

Is it possible to help me solve this, desperate and need to find a solution. Am I being dumb? Fellow South african here ;)

-----------------------------

Distict Values with where clause on column: Server Code

Why am i getting an empty result on this distinct query?

//var getRegion = localStorage.getItem('setRegion');
var getRegion = "CENTRAL";
//console.log (getRegion);

//distinct(dbApiKey, collectionName, columnName[, queryString][, token])
var result = Collection.distinct("xxxxxxxxxx", "Reach", "SalesDistrict",{where:{"Region": "'+getRegion+'"}});
Apperyio.response.success(result, "application/json");

If I remove the where clause it retrieves all the records in the Collection. I want the Distinct values based on the Region.

Currently this gives me a result of []!

-----------------------------------------------

Filter data that is in an array

Posted: Sat Aug 20, 2016 5:41 am
by Deon

Hi Robert

Glad to see fellow SAFFA using Appery.

I am presuming the following...
Your collection is called "SalesDistrict" and the column "Region" contains the distinct values you want to retrieve.
I am not sure what "Reach" is in your code, unless that is the collection name and SalesDistrict is your col name?

Try this?

var dbApiKey = "xxxxxxx";
var getRegion = "Central";
var result = Collection.distinct(dbApiKey, "SalesDistrict", 'Region', {"Region": "' + getRegion+ '"});

The above should return Central only.

result = Collection.distinct(dbApiKey, "SalesDistrict", "Region");
the above should return all distinct regions.

Let me know if that works for you.


Filter data that is in an array

Posted: Mon Aug 22, 2016 7:38 am
by Robert Lamb

Deon, any way I can bend your ear over an email?


Filter data that is in an array

Posted: Wed Aug 24, 2016 1:05 pm
by Deon

sure thing - a href="mailto:deon@software3.biz" rel="nofollow"deon@software3.biz/a


Filter data that is in an array

Posted: Thu Sep 15, 2016 3:32 pm
by Deon

Hi Robert. Drop me an email if you would be interested in working on some projects.
a href="mailto:deon@software3.biz" rel="nofollow"deon@software3.biz/a

Thanks
Deon