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

Database Join Concat Label renders properly in form view, not in list view

Discussion in 'Standard Support' started by flodg3, Jan 24, 2013.

  1. flodg3

    flodg3 New Member

    Level: Community
    I am hoping that this is either a straight forward fix or a simple 'sorry'.

    I have a database join element which works fine. It has a simple concat label which works fine in forms. It loads correctly in new forms and while re-editing saved forms. However the concat label does not render on list view, instead the join table id is displayed. I can't find any reason that it wouldn't also display the concat label.

    I have looked through the forums and also on the Wiki. I started my morning by updating from the GitHub in order to clear a previously posted about warning message (thank you again for your help there). I can post images and give examples but I'm hoping this explanation will be enough to get at least an initial response.

    For what it's worth, I tried additionally selecting a label to display (yes, in addition to having concat label). Magically, this label loads fine in the list view and the concat label still loads fine in the form view. I'm scratching my head over what might be preventing the concat label from loading in the list view.

    Thank you for any help.
     
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Can you paste your exact concat expression here?

    Basically I want to see if you are using the {thistable} placeholder. For instance ...

    {thistable}.last_name, ', ', {thistable}.first_name

    ... or whether you are using the literal table name ...

    yourtable.last_name, ', ', yourtable.first_name

    ... or no table name at all ...

    last_name, ', ', first_name

    The format you should be using is the {thistable} one.

    -- hugh
     
    1 person likes this.
  3. flodg3

    flodg3 New Member

    Level: Community
    So the database join element is called "home_lodge" and it is in a table called Brothers. It is trying to display rows from another table called Lodges, which holds the name and number of the Lodges.

    Originally I had the code as the following because, as I was constructed the form, it was what worked. Here name and number are columns in the Lodges table.
    name," No. ",number

    When I try the following, I get errors saying that 'brothers_repeat_home_lodge.name' is an unknown column.
    {thistable}.name," No. ",{thistable}.number

    I have included a screenshot of the element configuration.

    Thanks for the quick reply Hugh.
     

    Attached Files:

  4. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    So is 'brothers_repeat_home_lodge' the table this join element joins to? And should those fields exist on that table?

    -- hugh
     
  5. flodg3

    flodg3 New Member

    Level: Community
    Yes, 'brothers_repeat_home_lodge' is the table that was created by the database joins element. It contains only the ids for the Brothers and the Lodges. It does not contain any other information. Frankly, I wouldn't know how to make the database join include additional information, though that might solve my problem. I laid out the tables and you can see their relationship in the image attached. I have also included an image of the three databases as seen in phpMyAdmin. Finally, I included an image of what the form and list views look like, the issue is most obvious here.

    If you think that it would be easier, I can PM you a username and password for you to take a look. I'm very inexperienced with database joining and so it's sounding like that is the problem. However, it still seems weird to me that the concat (using the incorrect placeholders) works in the form view but not in the list view.
     

    Attached Files:

  6. flodg3

    flodg3 New Member

    Level: Community
    As a thought, I think that this is only a problem when the database join is rendered as a multi select dropdown. I'm not sure what that's worth but I was playing with another element as a database join and the problem only appeared once I changed its type from dropdown to multi select dropdown.
     
  7. flodg3

    flodg3 New Member

    Level: Community
    Friendly bump.
     
  8. flodg3

    flodg3 New Member

    Level: Community
    Friendly bump.
     
  9. rob

    rob Administrator Staff Member

    Level: Community
    Yup this sounds like its because its rendering as a multiple select dropdown.

    What you were expecting to happen is what should happen, it just wasn't working correctly.

    I've had a go at fixing this one so if you update from github and try again with the same concat syntax, it should work:

    Code (Text):

    [FONT=Verdana]{thistable}.name," No. ",{thistable}.number
     
    -Rob
    [/FONT]
     
    1 person likes this.
  10. flodg3

    flodg3 New Member

    Level: Community
    I just updated and it seems to work like a champ. I will let you know if I think it acts up again.

    Thanks for all you do.
     

Share This Page