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

Filter list by url - how to know which values were not found during the search?

ashishrij

New Member
I am taking an example from the Fabrik wiki:

http://site.com/mypage?
tablename___user_town[value][]=La Rochlle
&tablename___user_town[value][]=Paris
&tablename___user_town[join]=OR
&tablename___user_town[condition]=CONTAINS

It's clear that I am trying to search for values 'La Rochlle' and 'Paris' in the table 'tablename' under the column 'user_town'.

Let's expand this a bit now and say I am trying to search for 75 different 'user_town' instead of just the 2 towns as above. Out of those 75 towns, only 70 of them are present under the 'user_town' column and the other 5 are not.

The search result will return the list of those 70 towns that are present under 'user_town'.

The issue here is how would I know which 5 towns were not found during the search. It is not practical to go through the returned list and look through each column one by one.

If my explanation is not clear enough please message to explain in more detail.

Any help/ideas would be highly appreciated.
 
What do you want to achieve, what is your workflow, where are these cities coming from (the "complete" list and the "search" list)?
How would your query look in MySQL?
 
Thanks for the reply.

I will try to put things into context more.

I am creating an application to store information about 'Mobile phones'. Each phone has characteristics such as :

'IMEI NUMBER', 'JOB NUMBER', 'TRACKING'........and many more.

I have created a search form where the user can search the list which works like this:
upload_2019-11-8_10-50-34.png
- User will select by using which characteristics of the phone they want to search the list from a dropdown. For this example let's assume the user wants to search using 'IMEI NUMBER'.

- Users will then enter the IMEI numbers in the textarea, each IMEI number in a different line or separated by commas.

- to give more context, the phone's information is stored in dB table called 'aa_customer_device' and the column which stores IMEI is called 'device_imei'

- once the user clicks 'click to search' the information on the form is sent using GET to this PHP script where the code given below is run:

The code should be straight forward:

It gets the value from the dropdown - 'device_imei'.
It gets the IMEI numbers from the text area.
The list id is 27
and does a redirect

/index.php/?fabrik_list_filter_all_27_com_fabrik_27&resetfilters=1
&aa_customer_device___device_imei[value][]=imei number one
&aa_customer_device___device_imei[value][]=imei number two
&aa_customer_device___device_imei[join]=OR
&aa_customer_device___device_imei[condition]=CONTAINS

The query will be something like - SELECT * FROM `aa_customer_device` where `device_imei`= `IMEI number one` OR `device_imei` = `imei number two`....

I have pasted the actual code below:

The name of the text-area in the form is called "query-textarea". The name if the dropdown is called 'searchby'.

if(isset($_GET['query-textarea'])){
$query = $_GET['query-textarea'];
$searchby = $_GET['searchby'];
$query_split = preg_split("/[\s,]+/",$query);
$query_split = array_filter($query_split);
$jumpurl ="";
$size_of_array = (sizeof($query_split));

if($searchby == 'job'){
$searchby_value = '&track___job_no';
}
if($searchby == 'device_imei'){
$searchby_value = '&aa_customer_device___device_imei';
}


for ($start=0;$start<$size_of_array;$start++){
$jumpurl.= $searchby_value . "[value][]=" . $query_split[$start] ;

}
header("Location: /index.php/?fabrik_list_filter_all_27_com_fabrik_27&resetfilters=1" . $jumpurl. $searchby_value. "[join]=OR" . $searchby_value. "[condition]=CONTAINS");

The issue is - let's say the user search the list using IMEI as shown in the image below:
upload_2019-11-8_11-19-47.png upload_2019-11-8_11-25-47.png
works just fine. But as you can see there are only two matches. Two of the IMEI are present on the list and are displayed which is great. However, the third IMEI is not displayed since it's not present on the list.

If the user is searching 100 IMEI at once and only 75 are present on the list and 25 are not. The 75 IMEI are displayed but it would not be practical to go through the list now to figure out which 25 IMEI is not present on the list. I want a way to notify the user saying "These 25 IMEI are not on the list." At this point it doesn't matter how the user will be notified of that information - an email, a pop-up, a j! message, post a letter to their home, send a SWAT squad. It doesn't matter how but the point is the user should somehow be notified that these 25 IMEI are not on the list.



upload_2019-11-8_10-50-34.png
upload_2019-11-8_11-19-47.png upload_2019-11-8_11-25-47.png
 
Last edited:
It seems your search form is outside Fabrik (and also Joomla?).
You know the data you are searching for so you can also do some query NOT IN/NO EXISTS
 
Hi,

The search form is outside Joomla and Fabrik I was kind of hoping if I could somehow do it by adding a few more parameters on my search query.

But your suggestion should work perfectly. I haven't got a chance to work on it or think about it properly. I will probably work on this in the coming week and will post the outcome here.

Thanks again.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top