The same information via 'ask' or 'show'

From semantic-mediawiki.org

Thank you for the answer. I read the page you give the link to and could not find the answer. Let me put it in a different way: "Is it possible to insert in an article the list of property values similar to what we get in SearchByProperty special page?"

04:22, 11 April 2018

Ah, good point. I actually did not understand your original question and I was wondering why the question landed here.

To get a list of pages and their values you would do:

{{#ask:
 [[Has installation type::+]]
 |?Has installation type
 |mainlabel=
 |headers=hide
}}

or respectively

{{#ask:
 [[Has installation type::new]]
 |?Has installation type
 |mainlabel=
 |headers=hide
}}

If you only need the different values added to a property you need the help of the Arrays extension to do:

{{#arraydefine: values
 |{{#ask:
  [[Has installation type::+]]
  |?Has installation type
  |mainlabel=-
  |headers=hide
 }}
 |,
 |unique, sort=desc
}}

followed by

{{#arrayprint: values }}

I guess this is what you want to do. I am not aware of a way to directly simulate the output of this special page without using "tricks".

09:47, 11 April 2018

Thank you very much! That is what I was looking for. But now, when I've found it, I've discovered two more questions:

1) #ask generates list with comma as delimiter (separator), so if there is comma in resulting values the list become messed up. How to change delimiter in #ask so #arraydefine will split the list correctly? Inline queries, Selecting pages and Result formats give no clue.

2) How to handle "see more" link in long list to leave this link the last, when sorting, but not to sort with the query result putting somewhere in the middle?

10:53, 18 April 2018

In a lot of cases issues appear along the way when constructing queries.

1) Looking for a solution via result formats was right. The particular format used is "list", so you can use it's "sep" parameter to define another separator between results and let "arraydefine" work with it:

{{#arraydefine: values
 |{{#ask:
  [[Has installation type::+]]
  |?Has installation type
  |mainlabel=-
  |headers=hide
  |format=list
  |sep=;
 }}
 |;
 |unique, sort=desc
}}

2) Probably you do not want to have the "see more" link at all, since this is not a reusable value. Add the "searchlabel" parameter and hide the standard output. Also increase the result limit to a value higher than the number of expected results to make sure that you do not cut off valid values.

{{#arraydefine: values
 |{{#ask:
  [[Has installation type::+]]
  |?Has installation type
  |mainlabel=-
  |headers=hide
  |format=list
  |sep=;
  |searchlabel=
  |limit=500
 }}
 |;
 |unique, sort=desc
}}

Note configuration parameter $smwgQMaxInlineLimitSets the maximal number of rows ever printed by queries in connection with the limit parameter.

21:39, 19 April 2018

Thank you very much! Both answers are 100% useful.

10:49, 15 June 2018