DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:structjoin

structjoin Plugin

Compatible with DokuWiki

  • 2024-02-06 "Kaos" unknown
  • 2023-04-04 "Jack Jackrum" unknown
  • 2022-07-31 "Igor" unknown
  • 2020-07-29 "Hogfather" yes

plugin

Last updated on
2019-03-26
Provides
Action
Repository
Source
Requires
struct

Tagged with struct

Installation

:!: External requirements: This plugin requires the following additional plugin that must be installed separately:

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

Description

This plugin allows you to perform joins over struct schemes. It has some limitations but still can be very useful in many use cases. Introduction of joins into the struct plugin was discussed previously in #221, #269 and #285.

Usage

The idea is simple. A lookup column in your schema allows you actually to join your schema with another one but the limitation is that you can join only one column from it. This plugin introduces a new column type: “Join” that allows you to select other columns too. Let's have a look at example. Imagine that we have two schemes: “customer” and “product”. The customer schema has a following structure:

"columns": [
{
    "colref": 1,
    "ismulti": false,
    "isenabled": true,
    "sort": 10,
    "label": "name",
    "class": "Text",
},
{
    "colref": 2,
    "ismulti": false,
    "isenabled": true,
    "sort": 20,
    "label": "address",
    "class": "Text"
}
]

Now we want to create a product schema that has a product id, the name and the address of the customer that this product belongs to. We can do it using “Join” column type:

"columns": [
{
    "colref": 1,
    "ismulti": false,
    "isenabled": true,
    "sort": 10,
    "label": "Id",
    "class": "Text",
},
{
    "colref": 2,
    "ismulti": false,
    "isenabled": true,
    "sort": 20,
    "label": "customer",
    "class": "Lookup",
    "config": {
        "schema": "customer",
        "field": "name"
    }
},
{
    "colref": 3,
    "ismulti": false,
    "isenabled": true,
    "sort": 30,
    "label": "customer_address",
    "class": "Join",
    "config": {
        "schema": "customer",
        "field": "address"
    }
}
]

The join is performed on the Lookup column. The “customer_address” relates to the address of the customer select by the Lookup column.

The “Join” column type is not editable, you cannot put any data to it but it can be normally used in filtering and sorting.

Limitations

  • The Join column must be defined after the Lookup column.
  • You can have only one Lookup column per every joining schema.
  • The Lookup column must be selected if you want select the Join column. This won't work:
    cols: customer_address
  • You must always select the proper Lookup column before the Join column. This will work:
    cols: customer, customer_address

    but this won't:

    cols: customer_address, customer

Development

Change Log

Releases:

    plugin/structjoin.txt · Last modified: 2022-01-28 09:35 by Aleksandr

    Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
    CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki