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

Database Join: Add data to only the parent or child table. How?

Discussion in 'Community' started by amitfalana, Dec 3, 2019.

  1. amitfalana

    amitfalana Member

    Level: Community
    I have been struggling with the below for quite some time. Hope I am building it correctly!

    I am building a system wherein certain registered users (say U1) will submit data (Table: Submission, with a few child tables with FK to SubmissionID) and certain other users (say U2) will review data and provide comments (Table: Comments) against the submissions. (So, U1 will enter data for their submissions; U2 will see all the list of Submissions and provide comments to be stored in Comments). The Submissions to Comments is a 1-to-Many relationship. I have set different ACLs for the users.

    I have managed to get the Submission part working using Fabrik List/Form/Elements (Thanks to the Fabrik team for building such a great tool!!!). Although implementing the Comments part has been a struggle. I have created a Foreign Key in Comments linking to the SubmissionID, and done a DB Join for the same.

    Now when I enter a new Submission, it asks me for a Comment as well, which is not what I expected. I have tried to suppress this by using access control, etc, but have been unsuccessful.

    Thus my questions:
    1. Am I right to create a DB Join between Submission and Comments? If not, then how shall I manage this?
    2. If yes, how do I enable adding data to only the parent table (Submission table, while it has a DB join with Comments)?
    3. And, how do I enable adding data to only the child table (Comments table)?

    Thanks for your support! :)

  2. troester

    troester Well-Known Member Staff Member

    Level: Community
    Copy your submission list, give distinct names (e.g submission1), this will create a new set of list/form/groups/elements linked to the same database table(s).
    Edit your new list submission1 and delete the join to comments table.
    Now you should have a list without -[comments] group and elements.
    In the databasejoin "Frontend add" you'll see both forms submission and submission1, select submission1.
  3. amitfalana

    amitfalana Member

    Level: Community
    Dear troester,
    Thanks for your quick response. I do understand the solution provided and at some point was thinking of creating a view in the DB.
    Could you please explain the last step... Where exactly will I find the "Frontend add". I am unable to locate it in List/Form/Element. :(

    Thanks again!

  4. amitfalana

    amitfalana Member

    Level: Community
    Dear troester,
    I got it working. Was wrongly searching for a drop down names "Frontend add" in the admin panel. Got the menu item to point to submission1. Thanks again!


Share This Page