Use id from data container instance for populating another data container collection

I have

Data
    -> customerDc  (Instance)
           -> invoices  (Collection)
    -> customerSpendView  (Collection)

I want the query of the customerSpendView collection to use the ID of the customerDc instance.

I remember the old version of Cuba was something like where :id = ds$customerDs.id
But now I am using 7.1 of cuba and not sure how to get this.

I can’t seem to find anything in the documentation.

Cheers

Actually I think documentation is here: Data Components - CUBA Platform. Developer’s Manual

What I have come up with is something like:

@UiController("myapp_Customer.edit")
@UiDescriptor("customer-edit.xml")
@EditedEntityContainer("customerDc")
@LoadDataBeforeShow
public class CustomerEdit extends StandardEditor<Customer> {

    @Inject
    private CollectionLoader<CustomerSpendView> customerSpendViewDl;

    @Inject
    private InstanceLoader<Customer> customerDl;

    @Subscribe
    public void onBeforeShow(BeforeShowEvent event) {
        customerSpendViewDl.setParameter("customerId", customerDl.getEntityId());
    }
    
}

Then the query in the designer for the would be

> select e from myapp_CustomerSpendView e where e.id =:customerId

I presume this is how to go about it…

Hi,
In CUBA 7.1 you should use DataLoadCoordinator and new format of specifying connecting parameter names:
https://doc.cuba-platform.com/manual-7.1/gui_DataLoadCoordinator.html