I’m trying to create a SQL query for filtering cars based on selected options. Currently, my query retrieves cars that have either one or another selected option. However, I want to modify it to only show cars that have all the selected options.
The part that I believe needs modification is related to the ‘anuncio_opcionais’ (advertisement options) table, where I’m using the ‘in’ operator to check for selected options. How can I adjust the query to achieve the desired result?
would this be possible with the query builder? Or do I have to custom make?
If I understand correctly you want all the check boxes to be checked? (not 1 or 2 of them but 3 of them must be checked)
Is it possible to have a hidden text input on client side that it’s value will become true only if all check boxes values are checked, then pass this text input as an input parameter and complete the AND condition in you SQL query?
Just asking if this is doable. …
If the condition is this (checkbox1.checked && checkbox2.checked && checkbox3.checked) it works…
Hey @AdrianoLuiz
Late here in Argentina, so don’t know if I understand you correctly.
I see you use a split formatter so I assume you use comma separated values, but maybe you can play somehow with this:
Here I go:
Hi, thanks for the answers. I’m going to give you an example. I have several vehicles registered. On the registration screen, I can click on which options this car has, such as an alarm, 4 doors, and electric windows. What I want to do is a search that returns the vehicles with all the options that I marked. For example, if I mark an alarm and electric windows, the search should only return cars that have these two options selected. Do you understand?
In your case: myArray = Car options value array
and s1 = checked filter options value array
Since we’re talking about arrays, all we have to do is to translate this into wappler’s formatter.
I am not good on this but if I need to I can work it out. I hope it helps you find the solution…
The results are the expected.
But, tried to bind the parameters “items” (:p1 as an array) but have no results, need to pass 1,2 as ‘1’,‘2’.
Maybe someone can help to improve this.