Get filters to exactly match parameter

By: Vicky Tosh-Morelli | Asked: 05/09/2022
ForumsCategory: General questionsGet filters to exactly match parameter
Vicky Tosh-Morelli asked 3 years ago
I have a simple directory of people with a variety of affiliations which is a check box field. I use a single view but pass a parameter to get it to show only the people with that affiliation. Recently I had to add some additional affiliations and can't get the filters to pull people by their affiliation with an exact match. So when I want "scientists" I was also getting "core scientists". So I changed the first one to "Staff Scientists" but then the "staff scientists" also showed up as "Staff". The Filter looks like: Affiliation is equal to get param="pass_field"  I've also tried "like" instead of "equal to"  Is there a way to get the filter to do an exact match on a field or parameter?  
1 Answers
Victor Font answered 3 years ago
Are you familiar with SQL? When you add a filter to a Formidable View, you are instructing Formidable how to create the view’s SQL query where clause.   A where clause is a little tricky to construct when you deal with checkboxes. Checkboxes allow multiple selections. A checkbox field’s multiple selections are stored in a single text string. This is why the where clause is tricky. To search a string to find content embedded within it, the SQL must use like %search string%. 

There is a workaround but you need custom code. 
Vicky Tosh-Morelli replied 3 years ago

That makes sense. Since it's not a front-end form I just changed the affiliation to be more unique and that solved the problem. Good to keep this in mind for other development.

Johan Schweitz replied 2 years ago

Hi!
I encoutered this issue today and would be very interested to know more about the custom code that Victor was talking about. I am new to Formidable Forms but I have earlier experience with SQL. Please help me back on track!
Regards

Victor Font replied 2 years ago

Johan, instead of commenting on such an old topic, may I suggest that you ask a new question and explain the problem you are trying to solve and what is not working as expected?

Johan Schweitz replied 2 years ago

Hi Viktor, thanks for yor answer!
I am trying to filter a view by using a list of checkbox labels that "equals to" [get param=casenumb]. Casenumb is selected from a list with the same values as the list of checkboxes. The problem is that if a select "Köping" (a town in Sweden) I also get "Jönköping", "Linköping" (other towns in Sweden as results. As for now, adjusting the list of checkboxes is not an option. It would have unmanageable consequences because many parts of the web site is depending on this list. As I said, I am new to Formidable Forms and I have a new job consisting of cleaning up this web site. How would you resolve this?

Victor Font replied 2 years ago

This isn't enough detail to help. What type of checkbox, Dynamic, Lookup, or static? What are you using the parameters on, a form, field, or view? I had asked you to create a new question so everyone could see it. Questions added like this to another thread get buried and not many people will see them.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right