Fabrik / fabrik

Fabrik for Joomla 3.x
http://fabrikar.com
Other
254 stars 380 forks source link

{thistable} in multiselect dbjoin #1357

Open trob opened 9 years ago

trob commented 9 years ago

seems to be replaced wrong http://www.fabrikar.com/forums/index.php?threads/calc-element-works-on-list-but-crashes-form.40354/

jaanusnurmoja commented 9 years ago

http://www.fabrikar.com/forums/index.php?attachments/estimator-multi-select-data-png.12163/ http://www.fabrikar.com/forums/index.php?attachments/estimator-multi-select-data-where-png.12162/

IMO - I would make in his place a little bit simpler data where amd used id rather than username: {thistable}.id IN(SELECT user_id FROM idoli_users_usergroup_map WHERE group_id = 10)

trob commented 9 years ago

Yup, but this is not the problem. {thistable} is replaced with the repeat table name instead of the dbjoin table name. ...WHERE BW_PROJECTS_REPEAT_ESTIMATOR.USERNAME IN ( ... should be WHERE idoli_users.username

jaanusnurmoja commented 9 years ago

Strange, I don't have such problem Final edit: yeah, it still works for me both in dbjoin and cdd. But you can replicate this?

trob commented 9 years ago

I can replicate the issue. in my example dbjoin, multidropdown table = liste_einfach value = id label = feld

It's in two different places: if you are using WHERE {thistable}.feld form is ok but you get

1054 Unknown column 'test2_repeat_dbjoin.feld' in 'where clause' SQL=SELECT test2_repeat_dbjoin.id AS id,test2_repeat_dbjoin.parent_id, test2_repeat_dbjoin.dbjoin AS value, liste_einfach.feld AS text FROM test2_repeat_dbjoin LEFT JOIN liste_einfach ON liste_einfach.feld = test2_repeat_dbjoin.dbjoin WHERE test2_repeat_dbjoin.feld <> ""

in list view

If you are using the dbjoin table name directly (where liste_einfach.feld <> "") list is ok but you get

1054 Unknown column 'liste_einfach.feld' in 'where clause' SQL=SELECT DISTINCT(test2_repeat_dbjoin.id) AS value, feld AS text FROM liste_einfach AS test2_repeat_dbjoin WHERE liste_einfach.feld <> "" ORDER BY text ASC

in form view

jaanusnurmoja commented 8 years ago

This issue occurred for me when the multiselect dbjoin element pointed to the same table where the list is on. Creating a MySQL view and pointing to this instead solved the problem.