Preload data with nested and multiple values: Difference between revisions

From Visual Data Wiki
Jump to navigation Jump to search
(VisualData update)
(VisualData update)
jsondata
Line 2: Line 2:
     "schemas": {
     "schemas": {
         "Page classes": {
         "Page classes": {
             "classes": "535",
             "classes": "548",
             "add sub-classes": "false"
            "add sub-classes": "true",
            "sub-classes": "535",
             "add sub-sub-classes": "true",
            "sub-sub-classes": "543"
         }
         }
     }
     }
}
}

Revision as of 19:32, 14 May 2024

Syntax[edit | edit source]

This example shows a concept, how to handle the VisualData form parameter 'preload-data' with nested and multiple values. This makes it possible to generate dynamical forms, e.g. to collect data differentiated by district, gender and age categories:

...
|preload-data?classes/$/class name = District 1@@@@District 2@@@@District 3
|preload-data?classes/$/sub-classes/$/sub-class name = female@@@@male@@@@diverse
|preload-data?classes/$/sub-classes/$/sub-sub-classes/$/sub-sub-class name = 0 - 14@@@@15 - 29@@@@30 - 44@@@@45 - 59@@@@60 +
...

Notice the placeholder $ and the value separator @@@@. The value separator can be set in VisualData queries, see below.

Required json-diff library is not installed. Run composer in the extension folder to enable preload-data
form is loading...

See corresponding form Data Classes

(For styling see MediaWiki:Common.css)

Workflow example[edit | edit source]

Step 1: Define one or more statistical class sets[edit | edit source]

Required json-diff library is not installed. Run composer in the extension folder to enable preload-data
form is loading...

See available class sets


Step 2: Attach class sets to this page[edit | edit source]

form is loading...


Step 3: Add datasets to this page[edit | edit source]

...
|preload-data?classes/$/class name = {{#visualdataprint:{{#visualdataprint:{{PAGEID}}|?classes|schema = Page classes|format = raw}}|?class names|schema = Data classes|format = raw|values-separator = @@@@}}
|preload-data?classes/$/sub-classes/$/sub-class name = {{#visualdataprint:{{#visualdataprint:{{PAGEID}}|?sub-classes|schema = Page classes|format = raw}}|?class names|schema = Data classes|format = raw|values-separator = @@@@}}
|preload-data?classes/$/sub-classes/$/sub-sub-classes/$/sub-sub-class name = {{#visualdataprint:{{#visualdataprint:{{PAGEID}}|?sub-sub-classes|schema = Page classes|format = raw}}|?class names|schema = Data classes|format = raw|values-separator = @@@@}}
...
Required json-diff library is not installed. Run composer in the extension folder to enable preload-data
form is loading...