The userparam parameter can be used to pass values to the #userparam parameter for template calls of several result formats. This has two drawbacks:
Both could be resolved by introducing a syntax like:
| param <name> = <value>
which would be equivalent to | <name> = <value> when calling the template directly.
| param
<name> = <value>
A ResultPrinter is gating the parameter invocation with only those registered (defined per result printer, pre-execution) being available for further processing.
Changing the way this is implemented would require some work.
You could use a substitution template as in:
{{#ask: [[Has text::+]]
|?Has text
|userparam={{param|foo=1|bar=2}}
|template=Test
|format=template
|named args=true
}}
Template:Test will contain a reference to {{{#userparam}}}Template:Param (=={{param|foo=1|bar=2}}) is used as substitution so that you can refer to individual named parameters like {{{foo}}} or {{{bar}}} from within this template or act on its behalf#json_val parser functionWithout having SMW to do anything you could also use (transform relevant parameters into a valid JSON string):
{{#ask: [[Has text::+]]
|?Has text
|userparam={"foo":"abc", "bar":"def"}
|template=Test
|format=template
|named args=true
}}
Later in the template (given that someone provides such parser function) rely on something like {{#json_val:{{{#userparam}}}|bar}} to resolve the content of the JSON string and return the corresponding value of the selected parameter.
Thanks for the quick response! I am afraid I don't quite get how Template:Param would work / help, can you give an example? And I think this should be possible with stock MW + SMW without further extensions.
And I think this should be possible with stock MW + SMW without further extensions.
I understand the sentiment but someone has to invest (time, testing, writing code etc.) and commit to such endeavor and while it seems from a user perspective as "... should be possible with stock ..." this extension doesn't maintain itself therefore people who want a feature (or something to be a default functionality) to step up.
I wanted to give an early feedback so others can engage and discuss (as I won't have time for any commitment on this).
I usually write template = template{{!}}param1=value1{{!}}param2=value2 in {{#ask:}}.
Most helpful comment
I understand the sentiment but someone has to invest (time, testing, writing code etc.) and commit to such endeavor and while it seems from a user perspective as "... should be possible with stock ..." this extension doesn't maintain itself therefore people who want a feature (or something to be a default functionality) to step up.
I wanted to give an early feedback so others can engage and discuss (as I won't have time for any commitment on this).