Archive talk:Template format/archive

From semantic-mediawiki.org

Talk pages on this wiki should primarily be used to address possible mistakes as well as missing and superseded information in the documentation.
In case you are seeking support concerning individual questions, please have a look at this page. The Semantic MediaWiki user mailing list is always a good idea for seeking help.

Parameters[edit]

How to pass parameters into the template? I see there is "userparam" attribute - but the syntax is not clear

Hi, the parameters are set like this: "|parameter name=parameter value" Cheers --[[kgh]] 10:42, 8 November 2011 (CET)
Not precisely the question, kgh. The help text suggests something like {{#ask: <selection>|format=template|template=test|link=none|userparam=bla}} is possible, and Template:test would receive string "bla" as a parameter in some sort of fashion. However, I cannot get that result in my sandbox; "bla" doesn't show upin Template:test. I've mailed to the userlist about this, and will augment the documentation if I get a usable answer. --Jan "Saruman!" S. 11:18, 8 November 2011 (CET)
Ah, I thought what this would work. Thank you for mailing this to the user list. This will be of interest to others, too. Cheers --[[kgh]] 14:14, 8 November 2011 (CET)
Got the answer via the developer list; usage is now correctly specified on the help page including an example. --Jan "Saruman!" S. 13:06, 10 November 2011 (CET)
Thank you for doing this. Actually it seems to be quite a nice feature. :) Cheers --[[kgh]] 15:52, 10 November 2011 (CET)

Named and numbered parameters?[edit]

I hate that if I add a field to the query, I may disrupt the template because the numbers of the numbered parameters change, and using the same template across multiple queries is limited. Could we have named as well as numbered parameters? i.e.

{{#ask: ... | format = template | template = x |? this = THISSSS! |? that }}

and within Template:x we have:

Did you know {{{that}}} and also {{{this}}} (yes I said {{{2}}})?


kthnxby --Dan Bolser 00:54, 18 January 2012 (CET)

+1 --Jan "Saruman!" S. 08:05, 18 January 2012 (CET)
+1 Is this already on bugzilla to be voted on? --[[kgh]] 11:11, 19 January 2012 (CET)
Is this feature implemented/working? The help article suggests that it is, but does not provide a syntax. An example would be very helpful! -- MrT 04:52, 25 July 2012 (CEST)
Probably you are referring to the "named args" parameter. So far I have not used is. I will give it a try and add an example. Hopefully I will do this sooner than later. Cheers --[[kgh]] 10:31, 25 July 2012 (CEST)
Where is the bug?--Dan Bolser (talk) 20:45, 5 May 2013 (CEST)

The output of this example query seems not good[edit]

The output of this example query doesn't sound good. (See the Page.)

If we directly specify a single page, then normally the query results do not include the page, so to reuse the same template in the query below we must tell the query to display the page title as the first column by adding |?

{{#ask: [[Berlin]]
  | ?
  | ?Population
  | ?Area#km²
  | format=template
  | template=Query output demo
}}

Result: Berlin people squeeze into the 3,391,409 of Berlin.

The resulting sentence might be poor according to its meaning. --Linforest 17:13, 13 March 2012 (CET)

Heiya Linforest, this is definitely a behaviour change between SMW <1.7 and SMW 1.7+. I have therefore filed Task T37211 to let the developers know about it. Hopefully we get some comments on this so that we may decide on changing the documentation or not. For all reading this and interested in a workaround one could do
{{#ask: [[Berlin]]
  | ?Population
  | ?Area#km²
  | format=template
  | template=Query output demo
}}
or
{{#ask: [[Berlin]]
  | mainlable=-
  | ?Population
  | ?Area#km²
  | format=template
  | template=Query output demo
}}
Cheers --[[kgh]] 00:13, 14 March 2012 (CET)

Sep[edit]

Having just tried the sep-parameter for the template format, to no avail, I'm beginning to wonder if it was meant to work all. Is it perhaps a feature for the list format only? If so, that would warrant an explanation I think. Cavila (talk) 00:59, 3 August 2012 (CEST)

Ah, of course. What it separates, obviously, are the results of the query itself. What it does not separate are values of the printout statement, which for some reason always come out as comma-separated lists. You can customise this in the template using the arraymap function, but this will produce errors if you have values like "York, Ontario" (parsed as "York" and "Ontario", because there's a comma in the title). Time for a bug report, but the page is correct. Cavila (talk) 14:05, 3 August 2012 (CEST)


Tabular Output[edit]

I missed the very helpful link to CreateTabularOutput! on Referata. My wanderings are on Referata scratchpad], in case they are of interest. For some reason, the column header properties are not displaying as hot-links (headers=show not sticking?), but I am mostly off-to-the-races now.

Rodger

Hi Rodger, the link was indeed a bit hidden within the documentation. I added a tips section for better recognition. Cheers --[[kgh]] (talk) 19:25, 25 August 2012 (CEST)
There are no threads on this page yet.