Browse screen does not have a suitable filter error

Hi,

I’m getting some problems trying to open a new screen from an entity detail to view related entities.
I’m using RelatedEnitiesBuilder to show the screen as follows:

RelatedEntitiesBuilder builder = relatedEntitiesAPI.builder(this);

Screen movBrowser = builder
		.withEntityClass(TKmov.class)
		.withProperty("idtask")
		.withSelectedEntities(Arrays.asList(this.getEditedEntity()))
		.withScreenClass(TKmovLookup.class)
		.build();

movBrowser.show();

The new screen (a browse screen on related entity) is shown but objects are not filtered and the message “Browse screen does not have a suitable filter” appears.
Which kind of filter is required in the screen and how can I create it?

Thanks,
Andrea

Hi!

Your browser screen should just contain filter component:

<filter id="filter"
        applyTo="table"
        dataLoader="personsDl">
    <properties include=".*"/>
</filter>

Also, you can get this message when filter is applied for a different entity type and not to a related.

Thanks Roman.

I’m still getting problems, let me explain better my entities and relations:

  • A Tk object has a (one-to-many) relationship with TkMov objects (on Tk.id=TkMov.idtask)

I’m trying to open the related TkMov objectd starting from the Tk detail (edit screen).

This is my last attempt (button click handler):

RelatedEntitiesBuilder builder = relatedEntitiesAPI.builder(this);

Screen movBrowser = builder
		.withEntityClass(Tk.class)
		.withProperty("id")
		.withSelectedEntities(Arrays.asList(this.getEditedEntity()))
		.withScreenId("taskmanager_TKmov.browse")
		.build();

movBrowser.show();

Now I get this error:

java.lang.IllegalStateException: Range is datatype
	at com.haulmont.chile.core.model.impl.DatatypeRange.asClass(DatatypeRange.java:35)
	at com.haulmont.cuba.gui.relatedentities.RelatedEntitiesBean.lambda$buildScreen$1(RelatedEntitiesBean.java:453)

Thanks again,

Andrea

Related entities API allows you to show entities from property with association type, not an id.
In your case it will be possible to show related entities only for TkMov entity because it contains Tk.

If you want to show which entities (TkMov) related with Tk you can load them with nested collection.

See demo project how to load nested colletion of entities and show related entities using RelatedEntitiesBuilder: demo.zip (85.6 KB)

1 Like

Ok, it’s clear now. I’ll try to use nested collection instead.

Thanks!