Help:Semantic MediaWiki/Tips and tricks

This is a compilation of random SMW and Semantic forms tips and tricks learned by Wikia contributors.

Introductory tips

 * The type "Page" may appear useless because values returned from queries cannot be manipulated in templates because they have square brackets around them. To get the plain text values, add the operand "|link=none " to the query.

Values returned from #Ask queries can have hidden text

 * Problem you will see: #ifeq or #eval and other wikitext functions behave in unexpected ways with results from #ask or #show expressions. For instance, if you display the value returned from #ask, you see "foo", yet expressions like return false.


 * Verify you have this problem. Do a #len on the string. If this phenomenon is the culprit, you will see a wildly higher number than expected. Instead of the expected "3" for foo, you will see something like 24.


 * Explanation: SMW is inserting hidden text into the returned values. This may be stripped by a #replace operation.


 * Fix:

The same parameter is repeated in every template fed by a semantic form

 * Problem you will see: A semantic form with more than one "for template" is used to add data to an article. After editing the article modified by the form, there will be newly inserted parameter values inserted for all templates mentioned in the form.
 * Explanation: This is caused by mismatching between the form and the templates. By searching on the parameter value in the form and in the templates, you will either see that the there are no templates recieving the parameter, or that one of the templates is expecting a value that has not been set on the form.
 * Fix: Correct the mismatch by either adding or subtracting the parameters from either the form or templates, so that they are in agreement.

Parameters may be passed to template handlers for queries
For instance the following syntax will pass the value bar to Template "birthDisplay"'s parameter foo: