Removing table joins doesn't remove elements

Jaanus

Super Moderator
I tested something today, that meant adding and removing table joins many times.

After that I had 289 empty " elements" without name, label and corresponding group. That means in whatever reason removing table joins from list admin leaves rows in place in #___fabrik_elements .

Another issue - when you create join from list to another that have joins, many extra elements are created. Their original fields are in the tables that are joined to the joined one (brr, is it understandable what I said?)
 
It's understandable;)

I can remember the same issue:
"join to" drop down is showing the database tables but the created group contains additional elements if a fabrik list (any one, the first one?) linked to this database table has a join itself

It's easy to replicate.

I'm not sure if this was already an issue in fabrik2 (I can't find my thread or post)
 
One weird thing more. OK, I delete fully the "original" list representing table that I intend to join to another. But if I then create new join, the elements belonging to the deleted lists earlier joined table are still present in joined group! It seems like Fabrik "remember" ancient joins... :(

And now one perhaps stupid question. May it be possible that all problems are caused by the new version on MySQL in my hosts server? It's 5.5.24 now (earlier was 5.1....)
 
I also found this the same day.. Being new, I thought it was something I had done. Bauer? You're not alone~~ But I'm not taking sides.. but thanks for your detail in testing on your posts also..as with everyone else.
 

Attachments

  • AfterListFormJoinDelete.png
    AfterListFormJoinDelete.png
    67.3 KB · Views: 234
I also found this the same day.. Being new, I thought it was something I had done. Bauer? You're not alone~~ But I'm not taking sides.. but thanks for your detail in testing on your posts also..as with everyone else.
Thanks for making my weekend.;D You are very welcome.

It's good to know that someone apprecietes the extra effort I try to put into my self-appointed "job" as a volunteer "debugger". I am unique in that rather than just reporting bugs, I often try to find out why they are occurring (to be honest, mostly so I can move on with my work at hand). But I also figure that extra effort - passing on what I came up with - might help the developers speed up the process of fixing the bug. But oftentimes they don't seem to see it that way and are offended by my diving into their code, making suggestions, or "ribbing" them about a bug.

Like I have said, I am relying heavily on Fabrik for my current project -and I just want it to work as expected - for me and my client. As far as Joomla extensions go - IMO it's almost the greatest thing since sliced bread.:cool:

I won't let the friction I seem to have caused bother me - so long as I know SOMEONE appreciates the extra effort. Thanks again!
 
I tested something today, that meant adding and removing table joins many times.

After that I had 289 empty " elements" without name, label and corresponding group. That means in whatever reason removing table joins from list admin leaves rows in place in #___fabrik_elements .

Another issue - when you create join from list to another that have joins, many extra elements are created. Their original fields are in the tables that are joined to the joined one (brr, is it understandable what I said?)


Do you mean if for instance you have Table A ---> Table B joined.


Then you wish to join Table C to Table B?
 
Do you mean if for instance you have Table A ---> Table B joined.


Then you wish to join Table C to Table B?

I have List1 where Table A is main and Table B is joined.

Then I create list 2 where Table C is main and I want to join Table A. So I get also extra elements from Table B.
 
I don't think this can be done and yes it does create the blank elements when you try as I had a similiar scenario once before.

I think the blank elements are created because it aborts halfway through the process.

I could be wrong on this though. I think when using Fabrik 2 I used to create a copy of List1, break the join and then join list 2 to List 1. Then I used custom links \ templates and queries to get the information I needed.

I could be totally wrong on this though. I'm pretty sure Hugh called it 'Chaining' before and it's on the TODO list.
 
Raised a github issue. Working on it now.

Januus, thank you for the short, clear and concise description of how to replicate this issue.

-- hugh
 
OK, think I found the culprit. But before I commit, can the folk on this thread do some testing for me?

Around line 1012 in the admin list model (./administrator/components/com_fabrik/models/list.php), in the createLinkedElements() method is this:

PHP:
				// if we are saving a new table and the previously found tables group is a join
				// then don't add its elements to the table as they don't exist in the database table
				// we are linking to
				{
					continue;
				}

Locally, I have changed this to:

PHP:
				// if we are saving a new table and the previously found tables group is a join
				// then don't add its elements to the table as they don't exist in the database table
				// we are linking to
				// $$$ hugh - why the test for task and new table?  When creating elements
				// for a copy of a table, surely we NEVER want to include elements which were joined to the original,
				// regardless of whether this is a new List?  Bearing in mind that this routine now gets called from
				// the makeNewJoin() method, when adding a join to an existing list, to build the "Foo - [bar]" join
				// group, as well as from save() when creating a new List.
				//if ($groupModel->isJoin() && JRequest::getCmd('task') == 'save' && JRequest::getInt('id') == 0)
				if ($groupModel->isJoin())
				{
					continue;
				}

... which I think is correct. This bit of code is in the branch where we already have the 'target' table known to Fabrik, so are copying existing elements (and giving them parent_id's), rather than working from the MySQL table schema for a table Fabrik doesn't know about. And when copying those existing elements, we shouldn't care if this is a new List save, we simply shouldn't be including elements from a joined group on the existing version of the List, we should only care about elements which are in non-joined groups, i.e. exist on the actual table we are joining to.

Of course, then there's the issue of whether we should then create any additional joins on this copy of the List (or this new join), coresponding to the joined groups we just ignored the elements for on the original. But that's a different issue.

Anyway - can y'all test that code change by applying it locally, and let me know if it a) fixes the problem, and b) if it has any unintended side effects - I don't think it will, but that's why they are 'unexpected'.

Thanks,

-- hugh
 
With regards to the original subject of this thread, "Removing table joins doesn't remove elements", as far as I can tell, this fix may also fix that, as I *think* the elements that aren't getting removed are ones which shouldn't have been created in the first place.

I've run half a dozen tests on join deletions (after applying this fix and creating a number of test lists with a variety of joins), and we seem to be correctly deleting elements for joined groups, when deleting the associated join.

Of course even if this fixes that issue going forward, you may well still have orphaned elements in the fabrik_elements table.

Jaanus - in your OP, you said you had elements with no associated group. Does that mean the group_id field in the fabrik_elements table is empty / NULL, or set to a group_id that doesn't exist? Once I know this, I can give you a query you can run once by hand, to ream out the orphans.

-- hugh
 
::sigh::

I promised myself I wasn't going to respond to Baur's editorializing any more, but this:

I am unique in that rather than just reporting bugs, I often try to find out why they are occurring (to be honest, mostly so I can move on with my work at hand). But I also figure that extra effort - passing on what I came up with - might help the developers speed up the process of fixing the bug. But oftentimes they don't seem to see it that way and are offended by my diving into their code

... is such a bunch of bullshit. No, you are not, unique, we have quite a few people who find and fix bugs, and submit pull requests on github with code fixes.

And far from being offended, do you want me to dig up the number of times I have positively encouraged you to fork the project on github? And explained how this will make it easier for you to a) maintain any project specific code changes you need which aren't suitable for the main branch, and to b) contribute pull requests with suggested bug fixes on the main branch?

If you need help on how to set up a github account, fork Fabrik, and submit pull requests, just ask. I will be more than happy to help. A good place to start is here:

https://help.github.com/

... under "Set Up Git" and "Fork a Repo".

-- hugh
 
Jaanus - in your OP, you said you had elements with no associated group. Does that mean the group_id field in the fabrik_elements table is empty / NULL, or set to a group_id that doesn't exist? Once I know this, I can give you a query you can run once by hand, to ream out the orphans.

-- hugh

I can say both are equally close to truth :)

group_id = 0


Deleted them through phpmyadmin
 
Hugh, Is this change uploaded to Github please? As very early I set up a new sub-domain yesterday with fresh 2.5.6 and 739 on it..

It's still a virgin, and ready for testing.. Thing is, 02 :: 01 of your tutorial is where this happened for me, meaning I was playing with the JOIN, and then deleted it.. and the Category/List/Form etc...yet upon simply adding a new element then to my existing First table...is when a duplicate with the 2nd "deleted" came into play.

PS.. My attachment of image is one page one of this thread.

Jim
 
before I commit, can the folk on this thread do some testing for me?

No it not in Github yet, people need to do some testing.

I don't believe your problem is related though as this issue only happens with a particular setup, which certainly wouldn't be on the tutorials.

Maybe we can start a new thread for your issue, (if there isn't already one). I can understand how you may have thought this was related to your issue but I have a gut feeling it may be something else causing your problem.
 
@IanJim - I just committed the fix to github. But as of the time you asked no ... that's why in post #13 I said "But before I commit ...".

But that's now moot. Just grab a new github, and let me know.

But I'm not really sure what your issue is, as that image you posted just shows me (presumably) your element list after joining ... which by itself doesn't really tell me much, as I have no idea what should and shouldn't be there.

FYI, we find that Jing is a very powerful tool for explaining issues, as it lets you do short screencasts of the steps that lead up to a problem. It's free, as is up to 2GB of cloud storage. A picture is worth a thousand words, and a series of pictures making up a Moving Picture is worth ... hell, millions of words. :)

http://www.techsmith.com/jing.html

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top