Page 1 of 2

How to retrieve distinct values from a collection?

Posted: Fri Jul 05, 2013 9:42 pm
by Katja Knecht

Hi,

Unfortunately, I am not very familiar with databases and I have been trying for a while now to get distinct values from a database collection. I was wondering if you could help me. In your database documentation it says I should query 'where={projectID}' to get the distinct values of a column. (projectID is the name of the column I would like to get the distinct values of)

However, I tried it and it did not work. (I added the query as a javascript to the 'where' service parameter: return '{projectID}';)

Many thanks in advance for your help!


How to retrieve distinct values from a collection?

Posted: Fri Jul 05, 2013 9:58 pm
by Igor

Hi,

Please look at https://getsatisfaction.com/apperyio/...

Let us know if it helps.


How to retrieve distinct values from a collection?

Posted: Fri Jul 05, 2013 10:31 pm
by Katja Knecht

Hi Igor,

Thanks for the quick reply!
I had a look at this post earlier but it is not quite what I am looking for. I would be interested in the step 1 he described and which worked for him, though, i.e. to retrieve all possible values from a column in my collection without duplicates.

If my collection, for example, looks like this:

projectID | participants | etc...

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

100 | Ben | ...
200 | Mike |
100 | Sharon |
300 | Carl |

and I query for the distinct values in 'projectID' I would like to get the following response:
100
200
300

Any ideas?


How to retrieve distinct values from a collection?

Posted: Fri Jul 05, 2013 11:29 pm
by Igor

You can create "List" "database services".
pre
Image
/pre
Replace [collectionName] with you collection Name.
pre
Image
/pre


How to retrieve distinct values from a collection?

Posted: Tue Jul 09, 2013 2:58 pm
by Katja Knecht

Hi Igor,

Sorry, I only just got round to actually try it out using the list service. It works like a charm!

THANK YOU!


How to retrieve distinct values from a collection?

Posted: Sun Sep 01, 2013 3:40 am
by bahar.wadia

I am attempting to do exactly the same. I have followed the instructions above, but I keep getting the following error message with the GET method:

{
"status":"400 Bad Request",
"url":"https://api.appery.io/rest/1/db/colle...",
"response":{
"code":"BCXX002",
"description":"Cannot consume content type"
}
}

and here is the message I get with the PUT method:

Illegal parameter data type was specified

I am sure I am doing something wrong. Please help.

Thanks


How to retrieve distinct values from a collection?

Posted: Sun Sep 01, 2013 3:56 am
by Igor

Hello,

Please share app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a and tell us app name, service name.


How to retrieve distinct values from a collection?

Posted: Sun Sep 01, 2013 4:11 am
by bahar.wadia

Just did.

Also how do I send you the App name and service name in private.


How to retrieve distinct values from a collection?

Posted: Sun Sep 01, 2013 4:14 am
by Igor

You can send it to a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a.


How to retrieve distinct values from a collection?

Posted: Sun Sep 01, 2013 5:21 am
by Igor

I'll check and let you know.