KeyValueContainer and filters

Hi,

My app throws an exception when I try to create a filter condiftion on a table based on a KeyValueContainer:

IndexOutOfBoundsException: Index 1 out of bounds for length 1

My DL contains no JPQL query as it is a KeyValueContainer. Documentation tells us that Filter apply to KeyValueContainer by filtering data at database level. Sounds a bit confusing for me. :slight_smile:

Does filters works with KeyValueContainer ?
If no, is there something special to do to use filters with this kind of data container ?

Best regards, Stef.

Hi,
Please provide necessary information such as full exception stack trace, screen controller and descriptor code.
Otherwise it’s impossible to investigate your problem based on such a short description.

Sorry, requested elements: add-filter-exception.zip (5.1 KB)

May someone tell me if filters always need to be based on a JPQL request ?
Does KeyValueContainer can be filtered ? Does KeyValueContainer may be used the same as other data container ?

Yes, it is mentioned in the documentation:

Filter should be connected to a data loader defined for a CollectionContainer or KeyValueCollectionContainer. The loader should contain a JPQL query.

You can find an example of keyValueCollection that can be filtered in the issue comment:

<keyValueCollection id="myKeyValueCollectionDc">
    <loader id="myKeyValueCollectionDl">
        <query>select  u.login, ur.role.name, r from sec$User u join u.userRoles ur join ur.role r</query>
    </loader>
    <properties>
        <property datatype="string" name="myLogin"/>
        <property datatype="string" name="myRoleName"/>
        <property class="com.haulmont.cuba.security.entity.Role" name="myRole"/>
    </properties>
</keyValueCollection>

OK, my english is bad but I suggest to change “should be” to “must be” or “has to” which is clearer IMHO.

Thank you !