Filter component for generated columns

Hello Jmix team,

I’m thinking how to configure the filter component to be able to apply filtering for a generated column in a table.
I have the following:

@Install(to = "myTable.personName", subject = "columnGenerator")
private Component personNameColumnGenerator(final Person person) {
    String personName = person.getName();
    if (Objects.isNull(person.getName())) {
        personName = String.format("%s %s %s",
                                      person.getFirstName(),
                                      person.getMiddleName(),
                                      person.getLastName());
    }

    return new Table.PlainTextCell(personName);
}

Is this even possible right now?

Thanks!
Konstantin

Hi,

The filter component adds additional conditions to JPQL query, so in general it’s not possible to use it for filtering by generated columns (which are just a text generated by the application).

However for your specific case (generated column is just a concatenation of three database columns) you can define a JPQL condition in the filter that describes a query condition for three database columns.