34
Views
4
Comments
Multiple Filters in Table

Hi,

I'm having a problem using the filters on this page. When selecting, only one filter is used and when more than one is selected, the filter with the most results remains active.

How can I solve this? Below is an image of the page and the filter in the aggregate.



print2.png
print1.png
2024-12-02 13-16-47
Vipin Yadav

Hi _loiolapaulo,

You need to add conditions based on the parameters. If the parameter value is blank or a null date, the filters should be avoided.

If possible please share your oml file so that I will do the changes and let you know.

Thanks,

Vipin Yadav 

2024-12-02 13-16-47
Vipin Yadav

I have added below sample query with filters for your reference please check.

SELECT  *  FROM  {YourEntity} 

WHERE (@Filter1 IS NULL OR {YourEntity}.[Column] = @Filter1) 

AND   (@Filter2 = '' OR {YourEntity}.[Column] = @Filter2 ) 

AND   (@Filter3  = '' OR {YourEntity}.[Column] = @Filter3 ) 

AND   (@Filter4  = '' OR {YourEntity}.[Column] = @Filter4 ) 

AND   (@Filter5  IS NULL OR {YourEntity}.[Column] <= @Filter5) 

AND   (@Filter6  IS NULL OR {YourEntity}.[Column] >= @Filter6) 

AND    (@Filter7  IS NULL OR {YourEntity}.[Column] LIKE CONCAT('%', @Filter7 , '%')) 

Ensure input variables are passed from the screen to the SQL query. @Filter1 , @Filter2 , @Filter3 , @Filter4 , @Filter5, @Filter6  , and @Filter7  should represent your input filters.  

If a filter is not selected (null or empty), it is ignored, otherwise, it's applied, allowing multiple filters to work together seamlessly. Let me know if you need more help! 

Thanks,

Vipin Yadav


2024-09-12 02-43-38
Deepsagar Dubey

Hi @_loiolapaulo 

Try to simplyfy your logic using parenthesis or split filter in two or more expression, you have to understand first use of AND & OR

for AND condition - 1 & 0 = 0 (true & false = false)

for OR   condition - 1 or 0 = 1 (true or false = true)  

so use parenthesis to sepearte AND and OR logics.

i hope it'll help you.

Thanks
Deep

2021-11-12 04-59-31
Manikandan Sambasivam

Hi,

Please try the filter below

(AppointmentData.TipoSelecionado <> "" AND AfastamentoTipo.Label = AppointmentData.TipoSelecionado) OR (AppointmentData.CoordenacaoSelecionada <> "" AND SIGLA.Label = AppointmentData.CoordenacaoSelecionada) OR (AppointmentData.UsuarioSelecionado <> "" AND GestaoPessoas.Nome = AppointmentData.UsuarioSelecionado) 


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.