1. Fabrik 3.8.1 has been released. It is mostly bug fixes and feature enhancements, but does include two new plugins (push notifications, and the sequence element). As usual we strongly recommend testing the new release on a sandbox if your application is mission critical, and always do an Akeeba backup before updating.
    Dismiss Notice

Connected to existing joomla tables. Can't see id in form

Discussion in 'Community' started by cmendla, Mar 2, 2018.

  1. cmendla

    cmendla Member

    Level: Community
    I need to connect to existing Jbusinessdirectory tables via fabrik. There is a company-categories table that isn't getting updated when we add a company. My solution for now is to create the company and then add the entries to the table manually.

    I created a list called company maintenance. That uses the _jbusinessdirectory_companies table.

    The join is to company-categories which has the following structure

    # Name Type Collation Attributes Null Default Extra Action
    1 companyIdPrimary varchar(11) utf8_unicode_ci No Change Change Drop Drop
    2 categoryIdPrimary int(11) No None Change Change Drop Drop

    The join is a left join on companies to company-category

    I need to have the ID of the company record show in the form. That is the ID of the jbd-companies record

    1 idPrimary int(11) No None AUTO_INCREMENT

    I'd appreciate any thoughts on this.

    Just to rephrase: (jbd = j-businessdirectory)
    • I created a list that uses an existing jbd table
    • I linked that table to the jbd-company-category which is a two column table - company id, category id.
      • the left join is from company.id to company-category.company_id
      • There will be cases where the company does not have a corresponding company-category entry. The purpose here is to enter that manually.
      • The list shows what I need: Name, company.id, main_subcategory (category).
      • When I click edit, I see everything I need EXCEPT the company ID.


  2. Sophist

    Sophist Well-Known Member

    Level: Community
    Did you mean to post this in the Fabrik 2.5 forum? If not I can move it for you.
    Last edited: Mar 2, 2018
  3. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    I don't think it'll work. Sounds like the existing company-category table uses a composite key, and doesn't have a traditional auto-inc PK. And Fabrik can't handle composite keys, so won't be able to deal with have a list join to it.

    You could write a form submission script on your "companies" form that inserts the company-category mapping row "by hand" though.

    -- hugh
  4. cmendla

    cmendla Member

    Level: Community
    UPDATE - I took a different approach. Instead of trying to join the tables in Fabrik, I'm creating a view using SQL in Phpmyadmin.

    The way it is set up it has a crazy schema that probably breaks every rule of normalization. Anyway, I'm finding that Fabrik reads the views just fine. You can't update data in a view of course, but I don't need that for this app.
  5. Sophist

    Sophist Well-Known Member

    Level: Community
    Yes - I have used views too.

    You should make sure that the List will not try to update element types by setting List / Details / Advanced / Alter Field Types to "No".

Share This Page