Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: [FIXED] List filters NOT logic not working

List filters NOT logic not working 30 Nov 2016 23:16 #14783

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
I am trying to use
// Exclude All values
$this->setState('filter.territories.logic', 'NOT');

With one of my tables. Basically if an item is selected and the item DOES appear in the territories n:n table I want it excluding from the list (my interpretation of NOT)

However it is listing everything that DOES have that that value set just like AND / OR instead of listing everything BUT items that match

My territories table basically lists countries that an item is BARRED in, so if someone want to check that an item IS not barred, they select the country in the filter, and the NOT statement will list all the items NOT matching that list, This is not occurring
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.

List filters NOT logic not working 01 Dec 2016 01:12 #14788

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
For me it works.

PTL ?
Coding is now a piece of cake
The administrator has disabled public write access.

List filters NOT logic not working 01 Dec 2016 10:28 #14791

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
OK I have readded a little test data, project is Bid****1-2-5 (name masked)

The front end view which has the filter is LIBRARY

I have two items, one item is NOT available in France, the other NOT available in USA

The territory filter is obviously the default (whatever it is in sandbox) so if you select FRANCE then only the FRANCE one appears. However this (in my version) is a NOT filter

$this->setState('filter.territories.logic', 'NOT');

So when you select FRANCE, eveything BUT France linked items should appear
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.

List filters NOT logic not working 01 Dec 2016 12:07 #14792

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Today I am in a good mood, I've increased the RAM memory.

I cannot debug your project because there is not dataset in the project.
Can you make it more easy for me, including some datas please.
I don't see any dataset and any snapshot either. Are you working without dataset in the sandbox ?


The source code seems correct.
Did you tried the feature with a simplier project ?
I am gonna add this filter in the HelloMyWorld demo, for presenting it.

In you project, I cannot see any problem, it should work. But I cannot test, as I told you.
It is very long work to set the dataset, so please do it, and then I will give another look.
Coding is now a piece of cake
The administrator has disabled public write access.

List filters NOT logic not working 01 Dec 2016 12:15 #14793

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
OK thats wierd, i did create two items

will do again, i would not expect you to do it!
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.

List filters NOT logic not working 01 Dec 2016 12:15 #14794

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
PS, thanks for the extra ram!
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.

List filters NOT logic not working 01 Dec 2016 12:17 #14795

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
If you added simply on the sandbox, then the dataset auto-snap will be created after new generation in sandbox, or if you click to snapshot the dataset.

I will may not fix it today, because I have other priorities, but I will treat yours for first.
Coding is now a piece of cake
The administrator has disabled public write access.

List filters NOT logic not working 01 Dec 2016 12:20 #14796

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
Dataset is there now

I understand you are busy, but when you down load you should be able to add the NOT state in the model and access the library front end and see the NOT logic (hopefully) fail :-D

My assumption of NOT logic (going to over simplifiy)

Have a list of items A,B,C, D, E

if i have a list filter that I select A and B in, the NOT logic should return a search result of

C,D,E

(i.e list everything but do NOT show A and B)
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.

List filters NOT logic not working 01 Dec 2016 12:26 #14798

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
I am not sure you understand well the concept.

Let start again with my HelloMyWorld example.

I list all CITIES in the CITIES view.
The TRAVELLERS are linked to CITIES through VISITS (n:m PIVOT)
The TRAVELLERS column (N:m) show all TRAVELLERS which has VISITED the CITY.

In the template, the CITIES contains a LIST filter over TRAVELLERS.
When I set "Chris" + "Laura" in the filter,
With the "NO" logic, (manual at the moment)
I will only see the CITIES where (Chris OR Laura) never VISITED

With the "AND" logic,
I will see all CITIES visited by Chris AND by Laura

Is it what you understood ?

Got to go now, let's talk later.
Perso, I think it works
Coding is now a piece of cake
Last Edit: 01 Dec 2016 12:28 by admin.
The administrator has disabled public write access.

List filters NOT logic not working 01 Dec 2016 13:11 #14799

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
That makes sense, let me put it in terms of my component and try to draw parallels with yours (everything in brackets is a parallel with your scenario)

I have a list of FILMS (cities)
I have a list of TERRITORIES (travellers)
I have a pivot list of FILMS to TERRITORIES that the film cannot be shown in (visits)

By default a film is viewable everywhere (not been visited by anyone), but if for some reason a film cannot be shown in a TERRITORY that territory is selected in the film record (I note that the traveller has visited it)..

In the template FILMS contains a filter list of TERRITORIES (cities has a filter list of travellers)

With the NO logic if I select a TERRITORY (i.e FRANCE) I will only see FILMS that are NOT in the PIVOT table (if I select a traveller, i should only see cities they have NOT visited)

So I have ONE film that cannot be shown in North America, my territory has NOT logic so when I select North America that film should NOT be shown - but it is

Phew!!
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.

List filters NOT logic not working 01 Dec 2016 13:27 #14800

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
Something very basic just occured to me...

Can you tell me exactly where you are putting the

$this->setState('filter.regions.logic', 'AND');

$this->setState('filter.territories.logic', 'NOT');

or their equivalents in your component... (i.e file, and position)

I just removed the above statements... and nothing changed which means to me that I am likely being a muppet and they are just working 'as default'
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.

List filters NOT logic not working 01 Dec 2016 13:38 #14801

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
Me again

OK, getting somewhere.. kinda

I moved the statement to here
public function getItems()
	{
		$this->setState('filter.territories.logic', 'NOT');
		$items	= parent::getItems();
		$app	= JFactory::getApplication();
		$this->populateParams($items);
		//Create linked objects
		$this->populateObjects($items);
		return $items;
	}

But the problem is, this is now, with NOTHING in the list, filtering out ALL records that are in the pivot table (only a handful are in there), so any film that in in the list that is barred in any territory is just not listing at all, which should not happen, its only when I type select in that list that I would expect it to kick in?

I dont think this is the right place...
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.

List filters NOT logic not working 01 Dec 2016 13:52 #14802

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
OK - Realised my issue, i was called in the setState AFTER the $this->filterPivot( which is just stupid on my part, sorry

BUT there is definitely a problem which is hard to spot when you have a lot of data

This filter should not kick in unless you have selected something, BUT I have noticed (on my system anyway) that if the list filter is EMPTY, any record that is in the pivot table against any terirotry is NOT listed

i.e I have a film that is NOT available in North America, when i first hit the page with NO filters set, the film is NOT listed
If I select ANY territory other than North America, the film appears (great!) and if I select North America it is NOT listed (exactly what I want)
I have about 10 film out of 80 that have territorial restrictions, and when I load the list of films, when the territorial NOT filter is BLANK, those films are not listed.

Hope this is the case on your HelloWorld or traverller one

If I am using a NOT filter, but there is nothing actually selected, I would expect it to be ignored totally
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.

List filters NOT logic not working 02 Dec 2016 10:22 #14804

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
GOT IT !

The problem was occurring AFTER having set a value in the filter once, and then removed.
This was affecting the OR and the NOT filters.

So... FIXED, YEAH

About the correct place for the state var config filter, I suggest you to put it in the prepareQuery() function inside the context switch. This is a good place because you can see all contexts calls there, so it is really more convenient for re-use and for debug.

prepareQuery() is the dispatcher and presets of ALL your queries on the model. Do a smart use of it.

Note about the contexts:
With Cook, you can duplicate the same statement (addSelect(), addWhere(), ...), and the query will not raise any error. And this is VERY important because when the dispatcher contains a LOT of different profiles, it can be messy for not duplicating a SQL statement (causing SQL errors)
This can work only when 2 duplicate statements are exactly the same. Even the spaces are in the count.
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: MorganL

List filters NOT logic not working 02 Dec 2016 10:25 #14805

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 15
Good job!

Downloading and reinstalling beta now will fix the issue or is it still to be rolled out?
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 0.090 seconds

Get Started