Katja Knecht
Posts: 0
Joined: Fri Jul 05, 2013 9:42 pm

How to retrieve distinct values from a collection?

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!

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

How to retrieve distinct values from a collection?

Hi,

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

Let us know if it helps.

Katja Knecht
Posts: 0
Joined: Fri Jul 05, 2013 9:42 pm

How to retrieve distinct values from a collection?

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?

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

How to retrieve distinct values from a collection?

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

Katja Knecht
Posts: 0
Joined: Fri Jul 05, 2013 9:42 pm

How to retrieve distinct values from a collection?

Hi Igor,

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

THANK YOU!

bahar.wadia
Posts: 0
Joined: Wed Aug 07, 2013 2:05 am

How to retrieve distinct values from a collection?

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

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

How to retrieve distinct values from a collection?

Hello,

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

bahar.wadia
Posts: 0
Joined: Wed Aug 07, 2013 2:05 am

How to retrieve distinct values from a collection?

Just did.

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

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

How to retrieve distinct values from a collection?

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

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

How to retrieve distinct values from a collection?

I'll check and let you know.

Return to “Issues”