Forums

link two DB Multi Record Loaders troubleshoot ?

Lorentz 25 Apr, 2013
Hi,

first of all thank you for this forum and the component !


I don't know if it s a bug or if I am it.... but I followed step by step your FAQ "How can I link two DB Multi Record Loaders?" and I can't get the same result.

This is what I did, adding debugger :

exactly the same configuration :
1st DBMRL : Table:#_users, Model Id: User, Field boxes : name ; Load data : No, Enabled Asso : No, Join Rule 'Article'.'created_by'='User'.'id', Associated Models : Articles
2nd DBMRL : Table:#_content, Model Id: Articles, Field boxes : title; Load data : Yes, Enabled Asso : Yes, Join Rule : empty, Associated Models : User; Data displayer : Yes, columns to display : title: Title, User.name: Author

The result :
Data Array: 
Array
(
    [option] => com_chronoforms
    [tmpl] => component
    [chronoform] => test
    [Itemid] => 
    [Articles] => 
)
Validation Errors: 
Array
(
)
Title	Author
Debug Data
db_multi_record_loader
SELECT `title`, `User`.`name` AS `User.name` FROM `#_content` AS `Articles` INNER JOIN `#_users` AS `User` ON 'Articles'.'created_by'='User'.'id'


Then I've checked the sql query in phpmyadmin which return an sql error syntax.I've changed the join rule syntax to
1st DBMRL : Join Rule: Article.created_by=User.id (instead of 'Articles'.'created_by'='User'.'id' like the tutorial).

the result is :
Data Array: 
Array
(
    [option] => com_chronoforms
    [tmpl] => component
    [chronoform] => test
    [Itemid] => 
    [Articles] => Array
        (
        )

)
Validation Errors: 
Array
(
)
Title	Author
Debug Data
db_multi_record_loader
SELECT `title`, `User`.`name` AS `User.name` FROM `#_content` AS `Articles` INNER JOIN `#_users` AS `User` ON Articles.created_by=User.id


Nothing displayed but [Articles] is now an array. I try the sql query in phpmyadmin and it works perfectly. I get two columns with the title of the article and the User.name .

I 've changed the 2nd DBMRL Fields box to name,created_by,id without results. I've changed it to empty and then I get diplayed the articles in my Title column. Author stays empty.

This is the difference between Sql query :

SELECT `title`, `created_by`, `id`, `User`.`name` AS `User.name` FROM `#_content` AS `Articles` INNER JOIN `#_users` AS `User` ON Articles.created_by=User.id

SELECT `Articles`.*, `User`.`name` AS `User.name` FROM `#_content` AS `Articles` INNER JOIN `#_users` AS `User` ON Articles.created_by=User.id


Should it be Articles.title for working ?

I tried a lot of things, using custom code to find the problem, but I can't display correctly the User.name column. I succed getting User array in my Articles array and I am sure that the sql query works, so may be the problem is in the data display fields box with User.name:Author but I don't know what to write instead of.

As a last resort, I could use custom code to it๐Ÿ˜Ÿ

Thx for taking few minutes for helping me and translate me ... Sorry, english isn't my mother tongue .
Lorentz 27 Apr, 2013
Hello,

I'm still working on my problem. ๐Ÿ˜ถ

I don't know if it's a bug or if I am working bad with the component.
I forgot to specify that I am working on Joomla 2.5.10 and with choroform V4 Stable.

I did a custom code to get the result I wish and it works.

<?php
echo '
<table id=\"db_multi_record_loader_3960\"><thead><tr><th class=\"col1 cell\">Title</th><th class=\"col2 cell\">Author</th></tr></thead>

<tbody>';

foreach($form ->data['Articles'] as $detail){
echo '
<tr class=\"row_0\">
<td class=\"col1 cell\">'.$detail[title].'</td>
<td class=\"col2 cell\">'.$detail[User][0][name].'</td>
</tr>';
}
echo '</tbody></table>';


So I think there's a probleme with the data displayer option.
GreyHead 27 Apr, 2013
Hi Lorentz,

I'm delighted to hear that you've solved it, I've been waiting to find time to dig back into your question.

Bob
This topic is locked and no more replies can be posted.