• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Syncronizing two tables with dbjoin

  • Views Views: 7,055
  • Last updated Last updated:

Navigation

      Access element (+)
      Birthday element
      Button element
      Calculation element
      Captcha element
      Checkbox element
      Colour Picker element
      Count element (+)
      Database join element
      Date element
      Digg element
      Display text element
      Dropdown element
      Facebook Like element
      Field element
      File Upload element
      Folder element
      Google Map element
      Image element
         Image databese join
      Internal id element
      IP element
      J!Date element
      Kaltura element
      Link element
      Notes element
      OpenStreetMap element
      Picklist element
      Radio Button element
      Rating element
      Sequence element
      Slider element
      Tags element
      Textarea element
      Thumbs element
      Time element
      Timer element
      Timestamp element
      Total element
      User element
      User group element
      Video element
      View level element
      YesNo element
      Youtube element
      Akismet validation
      Is Email validation
      Is Not validation
      Is Numeric validation
      Not empty validation
      PHP validation
      Rsa id
  • Let's say you have two tables: actions and limitations and you have created Lists on both.

    In actions list you create a databasejoin or Cascading DropDown element rendered as checkboxes (or multiselect) pointing to the limitations table. Purpose - to be able to mark there all limitations corresponding to any action. Let give it the name limitations_id.

    As you just created a repeatelement, new database table actions_repeat_limitations_id is created with fields id_ parent_id, limitations_id and params. Field parent_id is the foreign key pointing to actions.id , another is fk for limitations.id.

    Now we suppose you want to do something similar in limitations list - to create dbjoin/CDD checkboxes/multiselect element actions_id pointing to the actions table so that you could mark all corresponding actions to any limitation.

    As you choose rendering as checkboxes/multiselect, new table limitations_repeat_actions_id is created (with fields id, parent_id, actions_id and params).

    Different tables behind the two Elements - that means you should fill the checkboxes separately.
    But there is still a way to synchronize the two tables as they had one common bridge table behind the dbjoin Elements! For that
    1. rename one of the '_repeat_' tables. E.g actions_repeat_limitations_id . Give it the name e.g actions_has_limitations.
    2. rename the field parent_id to actions_id (or something else whatever you want)
    3. create an updateable view (that means with cascaded check option) selecting all fields from actions_has_limitations:
      • select id, actions_id as parent_id, limitations_id, params from actions_has_limitations
      • and name it as the initial table - actions_repeat_limitations_id
    4. delete (or rename) limitations_repeat_actions_id
    5. create an updateable view with the same name (limitations_repeat_actions_id) like you did above (except you have to select limitations_id as parent_id)
    NOTE: Don't include data from any other table (and field) to these db views, otherwise they won't work as expected!

    Done! Your two tables are synchronized! When you open actions form and check all limitations corresponding to this action, then you will see the same action checked at each submission data. actions_has_limitations works as a main bridge and the newly created views are bridges between this main bridge and your two data tables.
Back
Top