Many To Many Relationship (Help, please)
-
I have created tables x_data, x_endowment and x_endowment_nm.
x_data:
several columns, some with ids and id/name lookups, but for simplicity I am leaving pout most of it so it does not get too confusing, hopefully.x_endowment:
CREATE TABLE x_endowment (id int(10) NOT NULL auto_increment ,name varchar(255) NOT NULL ,PRIMARY KEY (id) ) ENGINE InnoDB DEFAULT CHARACTER SET utf8 COLLATE=utf8_general_ci;
x_endowment_nm:
CREATE TABLE x_endowment_nm (id_data int(11) NOT NULL ,id_endowment int(11) NOT NULL ,PRIMARY KEY (id_data,id_endowment) ) ENGINE InnoDB DEFAULT CHARACTER SET utf8 COLLATE=utf8_general_ci;
In the data project pages:
x_data, x_endowment, x_endowment_nm set as type “parent/child”In the table options for x_data:
type: n:m source column: id target table: x_endowment target column: id relation table: x_endowment_nm
table options for x_endowment:
none
table options for x_endowment_nm:
type: 1:n source column: id_data target table: x_data target column: id type: 1:n source column: id_endowment target table: x_endowment target column: id type: lookup source column: id_data target table: x_data target column: id lookup: title type: lookup source column: id_endowment target table: x_endowment target column: id lookup: name
What I am getting: BE-Editing of x_data with the created WP Data Access page more or less works, meaning: the relation form below the normal fields appears. However, I am not getting the available rows from x_endowment, I can only create new rows, which then get a new row in x_endowment and a new row in x_endowment_nm with their corresponding ids.
What I was thinking of getting: being able to choose from the pool of already existing x_endowment rows and assigning them to the x_data rows, whereas x_endoement_nm holds the info about those. So I have a pool of x_endowment entries which can be reused and each only exist one time, being able to assign them to multiple x_data ids – or the other way around if you will.
I am relatively new to relations with a junction table, let alone WP data Access, so could somebody please bring some light to my rather hopeless situation?! ??
Thanks a lot!
- The topic ‘Many To Many Relationship (Help, please)’ is closed to new replies.