Domanda

In page "Massachusetts", I have defined an attribute:

[[country::USA]]

In page "Boston", I define another attribute, and reference a template:

[[state:Massachusetts]]

{{City
| state=Massachusetts
}}

In template: Template:City, I want to get the country of the city which uses the template by way of the state's property. I can reference the state like so:

{{{state}}}

And I can get the country by hand-coding the state:

{{#ask: [[Massachusetts]] | ?country=}}

But I want to do it using the parameter, like so:

{{#ask: [[{{{state}}}]] | ?country=}}

I'm told this should work, but however I format it, the command seems to return a list of all the attributes referenced in the wiki, whether I've defined them or not.

I see a lot of similar questions asked online, all described in various ways — nested queries, subqueries, linked properties, property chains, and so on — and they all have different suggested solutions, none of which seem to work. How can I do this, and is there a way to refer to this situation?

È stato utile?

Soluzione

The syntax shown above works:

{{#ask: [[{{{state}}}]] | ?country=}}

So does:

{{#show: {{{state}}} | ?country=}}

Check your parameter declarations, make sure you aren't declaring any twice.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top