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

Database join with where clause

Discussion in 'Community' started by Mono, Jun 11, 2019.

  1. Mono

    Mono Member

    Level: Community
    I have 3 tables

    Make, contains Names of makes
    Model, contains models relevant to Makes
    Vehicle, contains id from Make and Model

    When creating a new record in the table 'Vehicle' it is possible using a database join to select Make (works great)
    Then Model is ajax updated to only show models relevant to make (works great)

    When I return to edit the 'Vehicle' record, the 'Make' DBJoin is populated but the 'Model' DBJoin is 'Please Select'.

    If I change 'Apply Where When' in model DBJoin to NEW only, then the correct record is displayed but the dropdown is populated with every model for every make, as you would expect with no Where clause.

    Is there a way to use where clause when editing?
     
    Last edited: Jun 11, 2019
  2. troester

    troester Well-Known Member Staff Member

    Level: Community
    Should do.
    What are your settings? Are you using id[recommended] as value?
     
  3. Mono

    Mono Member

    Level: Community
    Hi thanks

    Yes I'm using ID

    This is my where

    Code (Text):
    {thistable}.fk_makes = '{tbl_vehicles___dbj_manufacturera}'
    eval default is set to no
    ajax update is set to yes
    add option in front end is set to yes.
    enhanced dropdown is set to yes
     
  4. troester

    troester Well-Known Member Staff Member

    Level: Community
    Try '{tbl_vehicles___dbj_manufacturera_raw}'
    _raw contains the value of the dbjoin
     
    Mono likes this.
  5. Mono

    Mono Member

    Level: Community
    Thank you very much, it worked a treat !!
     

Share This Page