INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: How to return a list of unique artists  (Read 1960 times)

PaulSinnema

  • Galactic Citizen
  • ****
  • Posts: 393
  • You don't know what you're missing until its gone
How to return a list of unique artists
« on: May 09, 2012, 01:27:22 am »

Hi,

I still don't fully understand the MC query language. I'm trying to return a list of artists. Each Artist should be in the list only once (distinct) and I would like to receive only 1 key of that artist.

I've tried this but that does not give me the result I want:

Code: [Select]
http://localhost:52199/MCWS/v1/Files/Search?Query=mediatype=[audio]&Fields=[Artist] ~nodup=[Artist]
It returns:

Code: [Select]
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<MPL Version="2.0" Title="MCWS - Files - 10348">
<Item>
<Field Name="Key">1</Field>
</Item>
<Item>
<Field Name="Key">2</Field>
</Item>
<Item>
<Field Name="Key">3</Field>
</Item>
<Item>
<Field Name="Key">4</Field>
</Item>
<Item>
<Field Name="Key">5</Field>
</Item>
<Item>
<Field Name="Key">6</Field>
</Item>
<Item>
<Field Name="Key">7</Field>
</Item>

....
</MPL>

Apart from the fact that it does not return the 'Artist' although requests in the 'Fields' the keys in the MPL are not corresponding to unique 'Artist' fields either.

Here is a result with Key and Artist

Code: [Select]
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<MPL Version="2.0" Title="MCWS - Files - 10548">
<Item>
<Field Name="Key">1</Field>
<Field Name="Artist">Montana Taylor</Field>
</Item>
<Item>
<Field Name="Key">2</Field>
<Field Name="Artist">Jazzanova</Field>
</Item>
<Item>
<Field Name="Key">3</Field>
<Field Name="Artist">Jazzanova</Field>
</Item>
<Item>
<Field Name="Key">4</Field>
<Field Name="Artist">Jazzanova</Field>
</Item>

You can see that the keys 2, 3 and 4 are duplicates

I've tried several variations but I just do not seem to be able to get the desired result.

Regards
Paul

Logged

Scolex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1116
  • Cheers
Re: How to return a list of unique artists
« Reply #1 on: May 09, 2012, 02:44:06 am »

If you just need the list of Artists without the keys the below works.
http://127.0.0.1:52199/MCWS/v1/Library/Values?Field=Artist&Files=[Media%20Type]=[Audio]
Logged
Sean

Lasse_Lus

  • Citizen of the Universe
  • *****
  • Posts: 999
Re: How to return a list of unique artists
« Reply #2 on: May 09, 2012, 03:51:57 am »

Quote from: PaulSinnema
Code: [Select]
http://localhost:52199/MCWS/v1/Files/Search?Query=mediatype=[audio]&Fields=[Artist] ~nodup=[Artist]

scolex url is the preferable here
but if you do these changes in your url -> Query=[Media%20Type]=[audio]%20~nodup=[Artist]&Fields=Artist

it will work as well
Logged
MT5FR

PaulSinnema

  • Galactic Citizen
  • ****
  • Posts: 393
  • You don't know what you're missing until its gone
Re: How to return a list of unique artists
« Reply #3 on: May 09, 2012, 07:56:53 am »

scolex url is the preferable here
but if you do these changes in your url -> Query=[Media%20Type]=[audio]%20~nodup=[Artist]&Fields=Artist

it will work as well
Hi Lasse,

I know Scolex's solution works because that is how I implemented it now. The problem with that is that I need to do an extra query with the ArtistName to get it's information. In a scrolling list that causes many queries being fired simultaniously which in turn leads to slow performance. With the '/Files/Search' I can get all the information all at once.

I've tested your adjustments and they work flawlessly, thanks for that.

Regards
Paul
Logged
Pages: [1]   Go Up