Working with a parametric search, was wondering after reading part of another post and testing myself, is there a way to use 'AND' for some custom field queries and 'OR' for others. Read below...
"Because you have OR between your conditions, records that match any of the other conditions will be displayed. Even if the date is outside of the range. Try using AND and you will only get those entries between the dates.
"
Here is my url: hidden link
It seems if I use only 'OR' it doesn't limit the results correctly as stated above, but if I us only 'AND', the user is required to fill in all fields before it returns a result. I would like the user not to have to modify every field if it is not needed for their search. Is their a way to use a combination of both 'AND & 'OR' in a query or some other way to go about this that would be better?
Dear Brent,
For an interval of dates, you can use the BETWEEN operator for comparing. This operator will ask you to introduce two URL parameters and so two filter controls. This way you can set AND/OR and still have the result dates between the required ones.
Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.
Regards,
Caridad
Yes I understand that, as you see I have accomplished that.
hidden link
I need to have results returned without the user having to fill in all of the filter inputs when they do a search.
I can do this when using 'Or' but then i run into this issue:
"Because you have OR between your conditions, records that match any of the other conditions will be displayed. Even if the date is outside of the range. Try using AND and you will only get those entries between the dates.
"
Using 'AND' the user is required to have all inputs filled in before it returns a result, not good for me.
So in my case, what i need to have happen is when a user sets a min-date and max-date, it should return all results between those two dates without the user having to select an area or lease type.
If the user does select an area or lease type, the results should then return posts that match the selected area or lease type between the selected dates.
Hope this makes sense.
Dear Brent,
Can you me a screenshot of the filters while editing your View?
Regards,
Caridad
Here is a screen shot of my current filters and view for this.
Dear Brent,
Changing the custom relationship to OR should works as you say. If it doesn't it means we have found a bug. Can you confirm?
Regards,
Caridad
HI thanks for the response, I think i figured most of it out. I was using a ' -' with a default value of 0 for the custom filters. These have to be blank so they don't pass any variables to the url string. Maybe you guys should make this more clear in your parametric filtering tuts.
The only thing I can't get to work is the dates because the datepicker automatically chooses today's date as it's default value and therefore passes that to the query string regardless if the user sets a min or max date. So it there a way to define default values for the date pickers?
Dear Brent,
I dont know of a way to set default values, but let me ask the developers for ideas.
Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.
Regards,
Caridad
Dear Brent,
We don't have a way of setting the default date for the date control in the front end filters. We will add it to our future todo list for Views.
Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.
Regards,
Caridad
No sweat, can do without for now.
Here is my final results.
hidden link