1. Fabrik 3.8 has been released. As usual, we strongly recommend that you backup your site (using Akeeba) before upgrading. Report any issues in the forums, we will answer promptly.

link to details of a row in a different table

Discussion in 'Community' started by enzo2016, Oct 12, 2017.

  1. enzo2016

    enzo2016 Member

    Level: Standard
    Hi,
    I would need to have a link to detail in another list. So for example, by clicking the link to detail, it should appear the detail of a record in another list linked through a databasejoin. The scheme should be the same of the link to detail here in Fabrik when clicking the link of a received reply.
    So I have two tables: "Reply" and "Thread". "Reply" is a list with the related data to "Thread". "Reply" is linked to "Thread" through the databasejoin {Reply___title}.
    I would like that by clicking on the Title on the Reply list, the related thread appears.
    So I wrote in the customized link to detail box:
    index.php?option=com_fabrik&view=details&formid=x&rowid={Reply___title_raw}
    where x= form id
    So in the frontend when I click on the link, it appears the detail of the related list, but it shows only the labels of the form, not the data filled in the form.
    How could the code above be amended in order to see correctly the related thread?


    Thanks,

    -- Enzo
     
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Does the URL look correct when you click on it? Does it have the right rowid?

    -- hugh
     
    enzo2016 likes this.
  3. enzo2016

    enzo2016 Member

    Level: Standard
    The URL appearing is: localhost/websitename/index.php/reply/details/26 (it is the id of the form "Thread")/titleofthereply (it is the content "taken" by the databasejoin element)

    The URL has not a rowid maybe because I haven't added it in the code. The rowid should be variable (not always the same) because it depends from the databasejoin.

    Thanks,

    Enzo
     
  4. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Does that join element store the 'id' of the joined table as the value? So in your join element's config, where you select "Value" and "Label", are you storing the 'id' as the value?

    -- hugh
     
    enzo2016 likes this.
  5. enzo2016

    enzo2016 Member

    Level: Standard
    Thank you very very much for the questions. They helped to find the error.
    Yes, the databasejoin had userid as value; I have changed it to id and then looked at the URL and noticed that the the "{" after rowid= was missing, so added it and now it is working ok.The code written in the first post is good. The error was only in my backend because I forgot to add a "{" in the code.
    I have seen that the details view does not include the related data referring to the list, so I would need a "link to list" not a "link to details". I have tried the new list plugin "link" and copied the code in the first post (of this thread) as link, but it seems not working.
    How can I create a "link to list" (not to details)?

    Thanks,

    Enzo
     
  6. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Well, the link url would be index.php?option=com_fabrik&view=list&listid=X

    But I'm not sure what "related date" you want to show. You'd need to add a filter to that URL, like &thread___something={replay___something}, but I don't know what field on threads is relating to what field on replies.

    -- hugh
     
    enzo2016 likes this.

Share This Page