dokuwiki-plugin-struct icon indicating copy to clipboard operation
dokuwiki-plugin-struct copied to clipboard

join two schemas

Open micha99 opened this issue 9 years ago • 3 comments

First of all: thanks for providing these plugins to the community. I am using both, the struct & bureaucracy plugin, they are great and really appreciated.

What I am looking for is a function to "join" the structured data from different schemas in a simple 1:N manner and it seems with the "lookup dropdown/lookup schema" features it was somehow intended, but I can't see a way to get it working. Maybe I am missing something more general here?

Here a quick example:

Schema "Country": name, president Page: US, Trump Page: France, Hollande

Schema "City": name, inhabitants, country(filled via lookup to "Country.name") Page: Lyon, 500.000, France Page: Paris, 2.200.000, France Page: Washington, 650.000, US

Overview/Aggregation page for all Cities:

---- struct table ---- schema: City, Country cols: City.name, City.inhabitants, Country.name, Country.president filter: City.country=Country.name

Expected result: city, inhabitants, country, president Lyon, 500.000, France, Hollande Paris, 2.200.000, France, Hollande Washington, 650.000, US, Trump

I'd love to have such a feature. Cheers.

micha99 avatar Feb 09 '17 12:02 micha99

this would be extremely useful

juliusverrel avatar Jan 31 '18 22:01 juliusverrel

This will be THE killer feature for this plugin and Dokuwiki in general.

stormlogix avatar Oct 10 '18 11:10 stormlogix

@micha99's example could be realized by a feature that might be easier to implement than joining two schemas: accessing different fields of lookup type fields of a given schema.

In his/her example, schema City has a field country of type lookup, referring to schema Country by Country.name. To list also the president's name in the aggregation, this kind of syntax would make sense:

---- struct table ---- 
schema: City
cols: name, inhabitants, country.name, country.president
----

Accessing different fields of lookup types in filters would solve a problem which I need to solve. I have three schemas, linked to each other in the following way:

  • User: list of users
  • Project: field "Members" is of type lookup, referring to one or multiple instances of User (say, by field ID)
  • Event: field "Projects" is of type lookup, referring to one or multiple instances of Project

Listing all events related to projects a particular user with ID XYZ is a member of seems impossible at present, but would be possible with the extension I suggested:

---- struct table ---- 
schema: Event
filter: Projects.Members.ID ~* XYZ
----

Note that Projects.Members.ID would be an expansion of nested lists, i.e., the list of all IDs of members of projects related to a given event.

BTW, if the link between these schemas was different, with users pointing to projects (instead of projects to users), a different filter option would be helpful, "nontrivial overlap" (denoted ~~ below):

---- struct table ---- 
schema: Event
filter: Projects ~~ $STRUCT.User.Projects$
----

juliusverrel avatar Mar 26 '19 22:03 juliusverrel