Demo VisualData 1.0 / Dependent values

Dependent values

From Wikisphere
Revision as of 10:42, 5 December 2023 by Admin (talk | contribs)
Jump to navigation Jump to search

The following form uses the schema PagePropertiesSchema:Dependent_values.

The first field (country) is a OOUI DropdownInputWidget with items taken from the template Template:Countries.

The second field (state) is a LookupElement with query

[[name::<country>]][[states/name::<value>~]]

where <country> is the name of the first field and <value> is the value being inserted in the input.. The requested printout is states/name that matches the path properties/states/items/properties/name in the schema PagePropertiesSchema:Country. (where only relevant property names are concatenated, leaving aside properties and items that belong to the schema structure). The query will search json data related to the schema "Country" with value of the property name equal to the value of the first field, and value of the property states/name equal to the state input value.

The third field (city) uses this query

[[name::<country>]][[states/name::<state>]][[states/cities/name::<value>~]]

The query as above will search json data related to the schema "Country" with value of the property name equal to the value of the first field, value of the property states/name equal to the second field, and value of the property states/cities/name equal to the city input value. The requested printout in this case is states/cities/name.

The query searches within a database of 250 wiki pages with content model json as the following Data:Countries/Afghanistan, containing more than 620,000 entries.

The database can been created downloading this data [1] from [2] and then importing them on your wiki using the following maintenance script:

php extensions/PageProperties/maintenance/ImportData.php --file "[path-to-the following-file]/countries+states+cities.json" --schema Country --pagename-formula "Data:countries/<name>" --main-slot


{{#pagepropertiesform: Dependent values |title = Dependent values |action = create |edit-page = |return-page = |view = inline |popup-size = medium |css-class = |pagename-formula = |edit-freetext = false |edit-categories = false |edit-content-model = false |default-categories = tasks |default-content-model = json |layout-align = top |popup-help = true |submit-button-text = |layout = tabs |submit-button-text = |validate-button-text = }}