Okay
  Public Ticket #1080009
Advanced Filtering
Closed

Comments

  •  2
    traffic4biz started the conversation

    How can I setup the wpdata table so that only records that match two separate column values are selected and displayed?

  • [deleted] replied

    Hi traffic4biz,
    Thank you for the purchase.

    I am not sure I understand you clearly. Can you describe this question in more details?

  •  2
    traffic4biz replied

    Hi Milos,

    If you select advanced filtering and include a form then the page displays two search fields A and B which are linked to the data containing those fields.

    I wish to show a record which will only appear when A AND B have the correct field information rather than A OR B which is what the default is. 

    The information held on the database is confidential so I don't want to display all the Milos for example if field A corresponds to the first name, only when the field B contains the surname Timotic. i.e. I don't want to display Milos Big, Milos Small, Milos Anything only Milos Timotic where both data fields have been specified precisely.

    Hope that makes it clearer.

    best regards

    Howard Baker

  • [deleted] replied

    Hi traffic4biz,

    I think it is working like that now if I understood you correctly. Please take a look at the images from the attachment. In the first image I have table with 2 columns and 3 rows with First Name and Last Name entries.

    If I select Milos in the filter for the first column, and Timotic in the Filter for the second column it will not display other results than just row that has Milos in the first column and that has Timotic in the second column.


  •  2
    traffic4biz replied

    Hi Milos,

    You are correct in that if I put Milos in the first box and Timotic in the second box then only your details appear.

    However if you put Milos in the first box and nothing in the second box ALL the Milos appear (and on my site there would be further confidential information appearing for all the 'Milos' which I do not wish to be visible.

    I only want the confidential information to appear when both boxes contain valid data

    Does that make sense?

    best regards

    Howard

  • [deleted] replied

    Hi traffic4biz,

    So as I understand you want that table is invisible until you select something from the selectboxes. When you select data in both dropdowns then you want to display the table with the results?

  •  2
    traffic4biz replied

    Hi Milos,

    Yes but only when both selectboxes have valid data, not just one or  the other, it must work only when both boxes contain valid data.

    best regards

    Howard

  • [deleted] replied

    Hi Howard,

    Unfortunately something like that is not possible out of the box, but it can be done with little jQuery customization. All you have to do is to hide table completely and then you can ask if there are values in the dropdowns then show the table with the data.

    You can add jQuery snippet directly on the page or you can create Custom Page Template and then enqueue custom JS file where will be the code.

  •  2
    traffic4biz replied

    Hi Milos,

    Many thanks for your replies.

    If in the MySQL box I add  - Select * from datatable with '%VAR1%' =surname AND '%VAR2%' = firstname - then this works if I put default variables in the %VAR1 & 2 boxes.

    All I need to know (and I'm a relative newbie to Wordpress) is how to create a query page that will call the 'View Data' page and pass these variables to it.

    Any ideas?

  • [deleted] replied

    Hi traffic4biz,

    I didn't understand you clearly. Can you describe me your issues in more details?

    Also I think that query should be:

    SELECT * FROM datatable WHERE surname='%VAR1%' AND firstname='%VAR2%' 
  •  2
    traffic4biz replied

    Hi Milos,

    You are 100% correct.

    How do do I create a page that will ask a user for the two fields then pass them to the page containing the datatable which use these two variables?

    I used to write in ASP and it would have been something that sent a get or post request to the next stage. However I struggle with WordPress and PHP etc. 

    Is there something in your program that generates such a page or can you suggest some other plugin that will do this?

    best regards

    Howard Baker

    (PS It doesn't help that I'm 70 years old!)

  • [deleted] replied

    Hi traffic4biz,

    Unfortunately it can be done just with the customization of the plugin. It requires jQuery and PHP custom coding. 

    As you're developing some custom solution if you need our assistance we can offer you our paid customization service.