Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Show unique items in List UI element

Hi Tim,

See the original documentation for requesting unique records: http://docs.appery.io/documentation/b...

​​"where" parameter is optional. But in your example, you are using a totally inappropriate request URL. At the link above, you can find a lot including what "where" parameter expects, if you really need it.

Tim Childs
Posts: 0
Joined: Thu Aug 01, 2013 3:35 am

Show unique items in List UI element

Hi Katya,

Again, the link you sent me does not make any sense to me.

I do not understand where in the interface I can request only unique records.

I have setup to populate a list with all dates (see first post screenshot).

I just want to add in a bit of code that makes sure all dates added are unique.

i.e. I have populated a list with the following value from a database collection:

Friday, August 10th, 2013
Saturday, August 11th, 2013
Friday, August 10th, 2013

I do not want the second "Friday, August 10th, 2013" to be added to the list.

How do I do this?

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

Show unique items in List UI element

Hello,

You should use "Distinct". Please take a look at next topic there is some screenshots https://getsatisfaction.com/apperyio/...
Please let me know if it helps.

Tim Childs
Posts: 0
Joined: Thu Aug 01, 2013 3:35 am

Show unique items in List UI element

OK I have got somewhere by using a POST rather than a GET:

{database_url}/collections/SCHEDULE/distinct/date

This is returning distinct dates:

[
"Friday, Aug 10th, 2013",
"Friday, Aug 17th, 2013"
]

How would I then put these values in to my List UI component?

Some kind of Javascript on success of service?

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

Show unique items in List UI element

You should map service response to list component. Please take a look at out tutorial how to do this http://docs.appery.io/tutorials/build...

Tim Childs
Posts: 0
Joined: Thu Aug 01, 2013 3:35 am

Show unique items in List UI element

I know how to map the service response when the column is listed in the response

i.e.

Code: Select all

 { 
     "_createdAt":"2013-08-08 22:43:17.127", 
     "_id":"52041f05e4b05261efb0568a", 
     "_updatedAt":"2013-08-08 22:47:01.147", 
     "date":"Friday, Aug 17th, 2013", 
     "location":"London, England", 
     "network":"HBO", 
     "opponent1":"Floyd Mayweather", 
     "opponent2":"Manny Pacquio" 
 }, 
 { 
     "_createdAt":"2013-08-08 22:52:44.935", 
     "_id":"5204213ce4b05261efb05692", 
     "_updatedAt":"2013-08-08 23:04:01.071", 
     "date":"Friday, Aug 10th, 2013", 
     "location":"Madrid, Spain", 
     "network":"BBC", 
     "opponent1":"Tim Childs", 
     "opponent2":"Matt Wakefield" 
 } 

But using the POST method the service is only returning the date values.

i.e.

[
"Friday, Aug 10th, 2013",
"Friday, Aug 17th, 2013"
]

How do I map these values to the List?

Tim Childs
Posts: 0
Joined: Thu Aug 01, 2013 3:35 am

Show unique items in List UI element

I worked it out using:

https://getsatisfaction.com/apperyio/...

Thanks!

Return to “Issues”