Wrong results while filtering a datagrid with Loaders with query conditions and columns filtering

Hi JMIX Team,

I know the problem explained below is very specific but i will try to explain the best i can. We are using 2.7 Version

We are having a problem with the behaviour of the filter embebbed in the columns of a datagrid.

We are using in our screen a loader with query conditions implemented as suggested in the JMIX documentation Data Loaders :: Jmix Documentation. Below is a piece of the query.

image

If we have this condition in the loader this affects the filtering behavior of the datagrid column filters. When we filter by two or more columns in the data grid, the results are wrong. After reviewing the logs we found out that SQL query instead of using AND is using OR for the conditions added by the datagrid column filters. We want to filter the 2 columns below by these 2 values.

image
image

The behaviour should be indepenent of the loader set because we have no add any query yet. We checked the SQL log and as you can see below the query is using OR instead of AND.

image

For testing purposue we check if the generic filter is behaving in the same manner, but the generic filter is running and AND instead of OR.

image

As you can see AND clause is correctly used when 2 fields are filtered with a loader using condition clauses.

image

Summary: Can you please check why the filter function is not working when we use the filtering in the columns of the datagrid for 2 or more values and we have query condition in the view.

Hi,

Try to wrap your or block with and block. Top-level logical operation within condition block can affect operation used to add filter condition:

Transform this

<query>
	<condition>
		<or>
			...
		</or>
	</condition>
</query>

to this

<query>
	<condition>
		<and>
			<or>
				...
			</or>
		</and>
	</condition>
</query>

Regards,
Ivan

Hi Ivan,

The solution works fine, thank you very much for the fast reply.

Regards.

Luis