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

List Filter via URL Issue

Status
Not open for further replies.

rackem

Well-Known Member
I am having an issue with a list that I filter via the URL. I am pretty sure I had this working at one point but now it is not.

The general filter format I am seeking is: (p1 = x OR p2 = x) AND table = y AND game = z

The "(p1 = x OR p2 = x)" part works fine but the "AND table = y AND game = z" portion seems to be ignored.

Here is an example URL:

/index.php?option=com_fabrik&view=list&listid=33&resetfilters=1
&mps_fargo_matches___p1_raw[value]=29
&mps_fargo_matches___p1_raw[join]=OR
&mps_fargo_matches___p2_raw[value]=29
&mps_fargo_matches___p2_raw[join]=OR
&mps_fargo_matches___table_id_raw[value]=1
&mps_fargo_matches___game_id_raw[value]=1

The list in question is here: http://www.mypoolstats.com/component/fabrik/list/33

The URL is created by clicking on the link in the "Fit" column here: http://www.mypoolstats.com/performance-ratings

Any ideas for where the problem might be or how to troubleshoot?
 
Go into the admin site global configuration and on the Server tab set error reporting to Maximum. Then go into global configuration option for Fabrik and set Allow fabrikDebug to 'Yes'. Then on your site urls, add fabrikdebug=1 to the query string of the URL and hopefully one or both debugs will shed some light on what is going on. The fabrikdebug option will let you see what values are there. Also remember to set them back to defaults when done debugging.

Dale
 
Thanks Dale! I tried that (using &fabrikdebug=1) and was a little confused at first which of the ~42 sections of data to check :eek: .

But I did find an error in 'list GetData:Matches' info. Here is what is shown (abbreviated):

SELECT ... WHERE ( `mps_fargo_matches`.`p1` = '29' OR `mps_fargo_matches`.`p2` = '29' AND `mps_fargo_matches`.`table_id` = '1' AND `mps_fargo_matches`.`game_id` = '1' ) ORDER BY `mps_fargo_matches`.`id` DESC

The problem is there are no parentheses around the OR part. It should be

WHERE ( (`mps_fargo_matches`.`p1` = '29' OR `mps_fargo_matches`.`p2` = '29' ) AND `mps_fargo_matches`.`table_id` = '1' AND `mps_fargo_matches`.`game_id` = '1' )

It looks like this is a bug? I am using the following format directly from the wiki (http://fabrikar.com/forums/index.php?wiki/filtering-lists-tables/):

?tablename___A[value]=foo&tablename___A[join]=OR&tablename___B[value]=foo&tablename___B[join]=OR
 
Have you checked the wiki for examples of URL filtering? I can't remember the exact syntax off the top of my head, but it involves grouping with extra [], if memory serves.

And yes, the getData() section is the one which shows you the actual query we wind up executing.

-- hugh
 
Thanks Hugh, your tip put me on the track to get the right query. :) However, if I move to a new page or change the number of items displayed in the list, then the list displays no records. :(

Here is the URL syntax that provides my desired format:

index.php?option=com_fabrik&view=list&listid=33&resetfilters=1
&mps_fargo_matches___p1_raw[value][]=29
&mps_fargo_matches___p1_raw[join][]=OR
&mps_fargo_matches___p2_raw[value][]=29
&mps_fargo_matches___p2_raw[join][]=OR
&mps_fargo_matches___p2_raw[grouped_to_previous][]=1
&mps_fargo_matches___table_id_raw[value][]=1
&mps_fargo_matches___game_id_raw[value][]=1

That correctly gives:
...WHERE ( ( `mps_fargo_matches`.`p1` = '29' OR `mps_fargo_matches`.`p2` = '29') AND `mps_fargo_matches`.`table_id` = '1' AND `mps_fargo_matches`.`game_id` = '1' ) ...

However, when I change the number of results per page or go to a new page,the list says "No records".

The URL changes to

component/fabrik/list/33?resetfilters=0&Itemid=&clearordering=0&clearfilters=0

Which is probably expected. Adding &fabrikdebug=1 to the URL shows that the problem is in the query which has changed to

... WHERE ( `mps_fargo_matches`.`table_id` = '1' AND `mps_fargo_matches`.`game_id` = '1' AND `mps_fargo_matches`.`p1` = '29' AND `mps_fargo_matches`.`p2` = '29' ) ...

Note the syntax has changed completely.
 
You've gotten deep in to Here Be Filtering Dragons country, which is way beyond my Community Support Brain. I'd have to set up a test which exactly replicates your setup, and start stepping through code ... which when it comes to filtering issues, is usually several hours work ...

-- hugh
 
Understood Hugh. It just looked like the filter state was not being stored or transferred correctly but I can appreciate there could be deeper and darker reasons. I wish I knew how and where to start troubleshooting further on my own but if it means stepping through code then I'm not set up for that.

I will see what I can do about a subscription. There were other issues I was queuing up to look into so perhaps this is a good time.
 
I've purchased a subscription, please move this thread to the Standard support forum.
 
Sorry, I hadn't had time to scan through Community for the last few days. I just saw your reminder on Standard. I'll move this thread, so we have all the info in one place, rather than using your new thread.

-- hugh
 
Hmmm, so far I haven't been able to replicate this, but I'm only using a simple case at the moment, with just two value with an OR. Changing the results per page doesn't change the query.

I'll gradually make my query string filters more complex to match your, and see what happens.

-- hugh
 
fyi the query string variables get set into the session so on page nav it would be expected that you don't see them in the query string. However as Hugh said they should still be applied.
Do you have any prefilters either set on the menu item or the list itself?
 
fyi the query string variables get set into the session so on page nav it would be expected that you don't see them in the query string. However as Hugh said they should still be applied.
Do you have any prefilters either set on the menu item or the list itself?

I understand the URL won't reflect my query string on page nav. I do not have any prefilters set on the list or menu item. If you want to see it on my site, the list is id=33 "Matches". There is no public menu item to the list although access is public. Front end users only view the list by clicking on the link in the "Fit" column of this list: http://www.mypoolstats.com/ratings . That link is generated by a calc element. Note the records at the top of the list ATM do not have any matches (Fit = 0(0)) but you can move in a few pages to records with a non-zero Fit value.
 
Cool, seeing your page at least tells me where the problem is, which is somewhere between:

Filter array: search form
... and ...
Filter array: beforeOnGetPostFilter

... according to the debug. That's where the [join] values all get set to AND, and the 'group_to_previous' gets unset. So that at least tells me where to look.

And is probably why I'm not seeing the problem, as I'm not coming from a search form, I'm just crafting a URL by hand.

-- hugh
 
My bad, you aren't using a search form, but that wasn't where it's happening ... it's happening in getPostFilters.

Trying to work out why my filters aren't being changed in there but yours are ...

-- hugh
 
It sounds like you were able to confirm the issue but not reproduce it on your test site?
 
I'm still working on it. Haven't forgotten about you. I can see where it's happening, but not why the difference between my site and yours.

-- hugh
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.
Back
Top