Using filter for multiple datasources

Hello, Is there a way to use filtration not only for a main (browsed) entity, but include other associated to a frame datasources?
And by the way, could i exclude system attributes from filter lookup?

Hi Ivan,

Is there a way to use filtration not only for a main (browsed) entity, but include other associated to a frame datasources?

The filter can be applied to a single datasource only. But it can create conditions involving related entities. You can even define custom conditions with arbitrary JPQL.

could i exclude system attributes from filter lookup?

Yes, use the exclude attribute of the filter XML element.

Yes, use the exclude attribute of the filter XML element.

But it’s not excluded from related entities…

There is additional attribute in the Filter component which is not mentioned in the docs (however visualized in Studio): excludeProperties. It allows you to list all properties including nested to exclude. So provided that category is a nested entity, the most compact definition excluding system properties will be as follows:

<filter id="filter"
        datasource="operationDs">
    <properties exclude="(createTs|createdBy|updateTs|updatedBy|deleteTs|deletedBy)"
                excludeProperties="category.createTs,category.createdBy,category.updateTs,category.updatedBy,category.deleteTs,category.deletedBy"
                include=".*"/>
</filter>

This is not very convenient for excluding all system properties down to the hierarchy, so we’ll think how to improve it. See https://youtrack.cuba-platform.com/issue/PL-10471

2 Likes

Thank you! this is definitely what i needed

I guess it should be a related question.
I have an entity, say, Vehicle with fields ‘series’, ‘name’, 'parameters’
Parameters is a one-to-many composition to VehicleParameters entity
VehicleParameters has fields ‘mass’, ‘model’ which are double and string

The question is: can i customize my filter (on a Vehicle screen) in the proper way for my customers to search all vehicles with a specific mass using search operations ( >, <, =, contains, etc)
Additional question is - can i use one filter text field to search by ‘mass’ and ‘model’?

A post was split to a new topic: Filtering by related entities in different data storage