0

On pages of my MediaWiki installation, I have a data property of the Record type that has a few different fields. On some pages of the wiki, I use the data property multiple times as there are different bits of information I want to be able to query from the page.

My ask query works, though it combines the fields of each instance of the property and separates them with commas. Is there a way to have each of the instances of the record property on an individual page returned as separate results?

Here is a representation of what the properties on the page look like and what they look like in the results of the query:

{{#set: Has Some Record=record1_field1; record1_field2}}

{{#set: Has Some Record=record2_field1; record2_field2}}

Output:

record1_field1, record2_field1

record1_field2, record2_field2

What I would prefer to have is:

record1_field1

record1_field2

and

record2_field1

record2_field2
Adam
  • 103
  • 4

1 Answers1

1

Use subobjects:

{{#subobject: record1 | field1=value11 | field2 = value12 }}
{{#subobject: record2 | field1=value21 | field2 = value22 }}

and

{{#ask:
 [[-Has subobject:: Page name ]]
 |?field1
 |?field2
}}
Alexander Mashin
  • 3,892
  • 1
  • 9
  • 15
  • Thanks! This works as expected. The only difference in my ask statement I queried one of the properties of the record instead. – Adam Jun 25 '22 at 13:57