Instance loader in create screen of an entity

Hi Everyone,

I am currently working on a entity screen which has entity editor and a table with datacontainer related to another enity.
When user create or edit screen i want to populate the table based on the instance variable of the edit screen.
Below is my enitity editor screen xml.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

    <instance id="lineofBusinessDc"

    <collection id="ordersDc" class="" view="_local" >
        <loader id="ordersDl">
                <![CDATA[select e from esmdtest_Error e where e.lobid = ds$lineofBusinessDc]]>
<dialogMode height="600"
<layout expand="editActions" spacing="true">
    <form id="form" dataContainer="lineofBusinessDc">
        <column width="250px">
            <textField id="nameField" property="name"/>
            <textField id="content_typeField" property="content_type"/>
            <checkBox id="is_esmd_claim_mandatoryField" property="is_esmd_claim_mandatory"/>
            <checkBox id="is_esmd_claim_displayedField" property="is_esmd_claim_displayed"/>
            <checkBox id="is_esmd_caseid_displayedField" property="is_esmd_caseid_displayed"/>
    <hbox id="editActions" spacing="true">
        <button action="windowCommitAndClose"/>
        <button action="windowClose"/>
    <table id="ErrorTable" height="100px" width="200px" columnControlVisible="false" dataContainer="ordersDc" >
            <column id="test"/>

I am currently having problem loading the dataconatiner of the table when i create a new entity. I am getting error unknown parameter “ds$lineofBusinessDc”
Please help me in resolving the issue.

Thanks in advance for the help

Hello there.

Yes, the problem is that linking containers like this is not supported in V7. A step backward in my opinion (since I used it a lot), but all is not lost.

There is an example on how to implement similar functionality here:

Screen mixins

If regex isn’t your bag, then you can always do it the long way around, but that would mean implementing similar functionality for every page.

Dependencies between data components

I’m not sure how your entities are arranged, but if the orders collection has a defined relationship with the linesOfBusiness (a one-to-many defined in the class) then you might get away with something simple, like this:

    <instance id="lineofBusinessDc"

              <collection id="ordersDc" property="orders" />
1 Like

Thanks for the reply.
I have created a collection in linesOfBusiness entity with a one-to-many relationship.
I am able to create a linesOfBusiness entity but when i edit the linesOfBusiness entity the collection is not being populated.
Could you please provide me any direction why the collection is not being populated

You need to subscribe to the ItemChangeEvent of the lineofBusinessDc and reload ordersDc like this:

@Subscribe(id = "ordersDc", target = Target.DATA_CONTAINER)
protected void onOrdersDcItemChange(InstanceContainer.ItemChangeEvent<Order> event) {
    orderLinesDl.setParameter("order", event.getItem()); 
1 Like