• 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.

Populate a dbjoin element based on another element

madpato

Member
Hello

I have the following situation: I have a dbjoin element that when selected shows certain information on another calc element (based on the selection of the dbjoin element). So far no problems there, but what if i need to modify the information of that calc element only in that record? (which exists in another table and is where the calc element gets the information, i would be need to with a dropdown select another option).
I was thinking on using another dbjoin element to do the calculation that my calc element does but its not working i have enabled eval and set the same code on the default field of the dbjoin:

Code:
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);

$myQuery
    ->select('vehiculo_conductor')
    ->from('mant_trabajadores')
    ->where('nombre_trabajador =' . $myDb->quote('{ots___conductor_ot}'));

$myDb->setQuery($myQuery);
$patente = $myDb->loadResult();
return $patente;

But its not working, any help is appreciated. Regards
 
... what if i need to modify the information of that calc element only in that record?
From what I understand, if you want to have the calc element storing different information for e.g. only one record, you certainly know which record this is. For example, you know its ID, or you base it on other element values in its list.
So, then you wrap your calc element code into an "if ... else", like so:
Code:
if ('{table___element}' == 123) {
    // return your exceptional, different value
} else {
    // do and return your usual stuff
}
Also, in your DB query code:
• Since loadResult() returns only a single value, are you sure that the "where" condition finds only one and not multiple?
• What element type is {ots___conductor_ot}? Could it be that you'll need to append _raw?
 
Hello thank you for your reply. Let me explain a bit more because i dont need a calc element (is what i am using but found that is not viable for what i need to achieve).
When i am entering a new entry on my form, on my dbjoin element (which is a dropdown) I select a person and that person is associated with a specific value from another table (lets call it table A), BUT sometimes we need to change that value from a list that is located in another table (table B). But only for this entry on this form.

If i use a calc element i dont have access to the list of table B thats why i think i need to use another dbjoin element. I have attached a small image maybe that makes things more clear on what i need. Thanks a lot.
 

Attachments

  • Captura.JPG
    Captura.JPG
    42 KB · Views: 51
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top