How to don't show repeated values

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to don't show repeated values

david-217
Hi, I want to show some values with inline queries but not repeating any
of them.

An example:

I have pages about education centers where I have a property called
'Town'.
i.e
[[Town::Barcelona]]

Then I want to show a text that says:

'We have centers from Badalona, Barcelona, Hospitalet, Mataró, Palma de
Mallorca'

Using a query in the sentence like:

We have centers from {{#ask:[[Category:Centers]]
[[Course:2011-12]]|?Town|mainlabel=-|format=list}}

But if I have 2 centers from Barcelona and 3 from Mataró the query shows
something like:
'We have centers from Badalona, Barcelona, Barcelona, Hospitalet,
Mataró, Mataró, Mataró, Palma de Mallorca'

How can I ask the query to don't show Barcelona twice and Mataró three
times?
How to show every value only one time?

Here is a test about that (the names of categories and properties are in
catalan):
http://lletra.uoc.edu/viquilletra/Usuari:Dvdgmz/proves#Test_repeated_values


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

Re: How to don't show repeated values

Sal Quintanilla
I'm not if you can do that with a query, but you can do it by filling an
array:

{{#arraydefine:TownList|{{#ask:[[Category:Centers]]
[[Course:2011-12]]|?Town|mainlabel=- |sep=, }}}}

and then running arrayunique to remove the duplicates

{{#arrayunique:TownList}}

Your output would be

We have centers from {{#arrayprint:TownList}}

See http://www.mediawiki.org/wiki/Extension:Arrays for details.

-----Original Message-----
From: david [mailto:[hidden email]]
Sent: Tuesday, January 24, 2012 4:43 AM
To: semediawiki-user
Subject: [Semediawiki-user] How to don't show repeated values

Hi, I want to show some values with inline queries but not repeating any of
them.

An example:

I have pages about education centers where I have a property called 'Town'.
i.e
[[Town::Barcelona]]

Then I want to show a text that says:

'We have centers from Badalona, Barcelona, Hospitalet, Mataró, Palma de
Mallorca'

Using a query in the sentence like:

We have centers from {{#ask:[[Category:Centers]]
[[Course:2011-12]]|?Town|mainlabel=-|format=list}}

But if I have 2 centers from Barcelona and 3 from Mataró the query shows
something like:
'We have centers from Badalona, Barcelona, Barcelona, Hospitalet, Mataró,
Mataró, Mataró, Palma de Mallorca'

How can I ask the query to don't show Barcelona twice and Mataró three
times?
How to show every value only one time?

Here is a test about that (the names of categories and properties are in
catalan):
http://lletra.uoc.edu/viquilletra/Usuari:Dvdgmz/proves#Test_repeated_values


----------------------------------------------------------------------------
--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers is
just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro
Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|

Re: How to don't show repeated values

david-217
Yes! Great! It works.

I saw that can be more compact writing 'unique' as a parameter of
#arraydefine:
{{#arraydefine:TownList|{{#ask:[[Category:Centers]]
[[Course:2011-12]]|?Town|mainlabel=- |sep=, }}|,|unique}}

Thanks Sal.

David.

El dt 24 de 01 de 2012 a les 07:19 -0800, en/na Sal Quintanilla va
escriure:

> I'm not if you can do that with a query, but you can do it by filling an
> array:
>
> {{#arraydefine:TownList|{{#ask:[[Category:Centers]]
> [[Course:2011-12]]|?Town|mainlabel=- |sep=, }}}}
>
> and then running arrayunique to remove the duplicates
>
> {{#arrayunique:TownList}}
>
> Your output would be
>
> We have centers from {{#arrayprint:TownList}}
>
> See http://www.mediawiki.org/wiki/Extension:Arrays for details.
>
> -----Original Message-----
> From: david [mailto:[hidden email]]
> Sent: Tuesday, January 24, 2012 4:43 AM
> To: semediawiki-user
> Subject: [Semediawiki-user] How to don't show repeated values
>
> Hi, I want to show some values with inline queries but not repeating any of
> them.
>
> An example:
>
> I have pages about education centers where I have a property called 'Town'.
> i.e
> [[Town::Barcelona]]
>
> Then I want to show a text that says:
>
> 'We have centers from Badalona, Barcelona, Hospitalet, Mataró, Palma de
> Mallorca'
>
> Using a query in the sentence like:
>
> We have centers from {{#ask:[[Category:Centers]]
> [[Course:2011-12]]|?Town|mainlabel=-|format=list}}
>
> But if I have 2 centers from Barcelona and 3 from Mataró the query shows
> something like:
> 'We have centers from Badalona, Barcelona, Barcelona, Hospitalet, Mataró,
> Mataró, Mataró, Palma de Mallorca'
>
> How can I ask the query to don't show Barcelona twice and Mataró three
> times?
> How to show every value only one time?
>
> Here is a test about that (the names of categories and properties are in
> catalan):
> http://lletra.uoc.edu/viquilletra/Usuari:Dvdgmz/proves#Test_repeated_values
>
>
> ----------------------------------------------------------------------------
> --
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers is
> just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro
> Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>



------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user