1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Multiselect dropdown dbjoin problem.

Discussion in 'Community' started by jh, Oct 31, 2018.

  1. jh

    jh Member

    Level: Community
    Hi

    I seem to have run into a bit of a problem with elements set as a multiselect dropdown dbjoins.
    I have 2 tables joined - says table A and table B. Table A has a few multiselect dropdown dbjoins to other tables. This all works and presents fine, both on table A when inputing/viewing data and when joined to table B.


    However when a record is deleted from table B, I have found that the values of any multiselect dropdown dbjoins in table A is now blanked. I have checked on CSV file and the values have gone . No other field values are gone (including single select dbjoin fields).

    I have tried a few different things but I can not seem to stop this from happening. Have a got a setting wrong somewhere?

    Kind Regards
     
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    I can't replicate this.

    When you say "when a record is deleted from table B", you mean directly from the list built on table B?

    Can you have a look directly in MySQL, using phpMyAdmin (or whatever). there should be a table called <table_a>_repeat_<element_name>, using your table A name and the join element's name, which is the "junction" table between table A and B. It will have four fields, id, parent_id, <element name> and params. The parent_id will have the ID of the table A row (parent), <element name> will have the ID of table B (child).

    Can you confirm whether any of those rows are changing when you remove something from table B?

    -- hugh
     
  3. jh

    jh Member

    Level: Community
    Hi

    Thanks for your reply.

    To confirm:

    "When you say "when a record is deleted from table B", you mean directly from the list built on table B?"

    yes to this (deletion is on the admin list side for table B). Table B has an inner join to table A.

    I have looked at the tables in phpMyAdmin (they are there and work as expected I assume when adding data). However when the record is deleted from table B, then this record is deleted too (completely removed).

    Also, and apologies if I wasn't clear, the multiselect drop down on table A is to table C (so the child ID is to table C).

    Should I not be deleting a row from a list with a join like this or is there some other error I have made.

    EDIT:
    Ive just tried deleting from a list of table B without the join and the deletion does not occur. I assume the deletion occured because of the join. Apologies if I hadnt quite grasped how the join was working as no other elements seemed to be affected.

    Thanks for your help.
     
    Last edited: Nov 1, 2018
  4. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Sorry, I'm totally confused. How are A, B and C related?

    The only way values for the multiselect join could be removed is if the rows in that autoatically created junction table are deleted for a specific parent_id.

    -- hugh
     
  5. jh

    jh Member

    Level: Community
    Hi

    Sincere apologies for not being clear:
    Table A - Pattern
    Table B - Item Type
    Table C - Colour

    Table A has a multiselect dbjoin element to Table C. Works fine for inputing, display and related record link.
    Table B is joined to Table A via single dbjoin.

    For a list view, table B is joined to table A via table B FK.. All information displays correctly.
    However when deleting on this list view, the multiselect dbjoin values are deleted on table A (no other entered values seem to be deleted).
    I realised this only occured when deleting on the list view with the join (from table B to A). When deleting directly from table B (without the join) this delete does not occur.
    Apologies if I have not realised the table/list join has caused the delete however I would like to be able to delete on the joined table view without this occuring.

    Kind Regards
     
  6. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    When you delete in list view, you are deleting the parent row.

    -- hugh
     

Share This Page