Solved: Content plugin not equal !=

sunnyjey

Active Member
Is there any way to filter content plugin result using not equal (!=) or not identical (!==) operator ?

e.g

{fabrik view=list id=1 tablename___elementname!=foobar}

Just to give an example. I have F! List of Hotels. In the detail view of one of the Hotel (Say Metro-Hotel), I am showing other Hotels in the same city:

{fabrik view=list id=1 tablename___city_raw=New York}

But, this displays all Hotels in the City including the current Metro-Hotel. How do I exclude the Metro-Hotel from the list ?

{fabrik view=list id=1 tablename___city_raw=New York tablename___id_raw!=[rowid]}
 
I had already tried <> multiple times, but it doesn't work. Ironically, <> it works as = (equal to).

If possible, can you check at your end by testing at your server.
 
Last edited:
Ok, the syntax is
table___feld[value]=something table___feld[condition]=<>

It seems only for = you can use directly table___feld=something
(which makes sense because the content plugin params are like URL params)
 
I did it, it's working.
Maybe it's some caching, try to
- set your list to "disable caching"=yes
- add resetfilters=1 in the content plugin string

I think strings must be URL encoded, so not New York but New%20York.
What are your element "List view"/Filters settings?
 
I really don't know whats is going wrong.

When I add following to the URL directly in browser :
Code:
mydomain.com/myfabriklist?mytable___city_raw=14&mytable___id[value]=489&mytable___id[condition]=<>

The URL filtering works. It nicely removes the rowid number 489. But when I put same in content plugin like:

When I use same in the content plugin:

Code:
{fabrik view=list listid=1 resetfilters=1 mytable___city_raw=14 mytable___id[value]=489 mytable___id[condition]=<>}

It throws the following error, even after deleting cache & different browsers:

Fabrik has generated an incorrect query for the list Radiologist Profile:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '489 )
ORDER BY `mytable`.`id` DESC' at line 10

I am just clueless.
 
Last edited:
You must separate the parameters (without the & needed in the URL)
mytable___city_raw=14 mytable___id[value]=489 mytable___id[condition]=<>
Make sure that you don't have any formatting or multiple spaces inside {} (Check with a raw code editor tab)
 
You must separate the parameters (without the & needed in the URL)

My bad! I have placed correct code on my server without 'any gap' or '&' in content plugin. Here, at forum I just copied from URL code but forgot to remove '&' from the code, which I just edited & corrected.

There is something wrong. I tried and tried again with different elements, different list & different custom detail template. Deleted Cache & also Deleted Prefilters. But getting same error:

Code:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '489 )

In protostar Template, I'm getting following error:

Code:
#500 Fabrik has generated an incorrect query for the list mytable: <br /><br /><pre>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '489 ) ORDER BY `mytable`.`id` DESC' at line 10</pre>

Just want to make sure, have you tried content plugin <> filtering in Custom Detail template ?
 
Just want to make sure, have you tried content plugin <> filtering in Custom Detail template ?
Ok, it's not working in a template, I get the same error there.
But it's working in the intro...

It's the < which is not handled correctly (condition=< is breaking also)
Trick:
use &lt;&gt;
So
{fabrik view=list listid=1 resetfilters=1 mytable___city_raw=14 mytable___id[value]=489 mytable___id[condition]=&lt;&gt;}
is doing also in the template on my site
 
Thank you so much for taking your time and confirming this BUG!

Hope @cheesegrits will make necessary changes, till then &lt;&gt; will do my job :).

Just to notify, => & =< are also not working in custom template.
 
It's not a bug, it's just that templates are actual PHP files, rendering directly, so if you want a < or a > to render correctly, you have to encode them.

-- hugh
 
Ok, it's not working in a template, I get the same error there.
But it's working in the intro...

It's the < which is not handled correctly (condition=< is breaking also)
Trick:
use &lt;&gt;
So
{fabrik view=list listid=1 resetfilters=1 mytable___city_raw=14 mytable___id[value]=489 mytable___id[condition]=&lt;&gt;}
is doing also in the template on my site

Code:
&lt;&gt;

This is throwing error in 8.x php, but works in 7.x php versions. Is there any way to get it working in the 8.x php version too ?
 
{fabrik view=list listid=4 layout=div test17___id[value]=305 test17___id[condition]=&lt;&gt;}
or
{fabrik view=list listid=4 layout=div test17___id[value]=305 test17___id[condition]=&lt;>}

is both working on php8 in a details template (Fabrik 3 and Fabrik 4) and in an article (Fabrik 4)

It seems <> is working in J!3/php8 article.
 
Thank you @troester for taking time and testing on php 8 version.

Strangely, I am getting error for same code. I have tried with multiple combinations. It looks there is some issue with my server, may be some plugin/module/extension of php is not enabled or maybe due to some firewall (though it is less likely) system installed on my Server.
 
We are in need of some funding.
More details.

Thank you.

Staff online

Members online

Back
Top