• 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!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter cybastian

    (@cybastian)

    I cant find any edit functionality for the post, so I’ll leave it here:
    the table names above are renamed for privacy reasons so I am hoping I didn’t mix things up badly …
    If someone could give a hint or something this would make my day, no WEEK. ??

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi @cybastian,

    Looks like you are almost there…

    Your settings for table x_data are fine. You just need to configure table x_endowment the same way. The plugin needs the relationship data for both ends of the n:m relationship. If you add the relationship for x_endowment just like you did for for x_data, you should be fine.

    You can delete the table options for x_endowment_nm. The plugin does not (yet) use any settings for the n:m table (is on my to do list).

    Please let me know if this helps. If you want me to look at your data model, you can use the contactform on the plugin website to send it in private.

    Best regards,
    Peter

    Thread Starter cybastian

    (@cybastian)

    Hi @peterschulznl,

    thanks so much for your reply, I have tried to set the relation for the x_endowment as well but get the same results as without them.

    I have used the contact form on the plugin page to send you the project (at least I hope it’s complete enough). It would be really great if you could take a look at it.

    Best regards,
    Sebastian

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Sebastian,

    Just wanted to let you know I received your mail. I’ll try to have a look at it asap…

    Best regards,
    Peter

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Many To Many Relationship (Help, please)’ is closed to new replies.