How do l retrive a list of objects through a Mendix domain model association in React

I want to show on a page a grid of products with their associated sales behavior using a React widget In the following domain Model I have a Products table with a one to many relationship with a sales table Where I’m have a problem is setting up the XML to describe this model in React   <name>Product Vs Sales</name>     <description>Product Vs Sales description</description>     <properties>         <propertyGroup caption="Product Objects">             <property key="Products" type="object" isList="true">                 <caption>Products</caption>                 <description>List of Product</description>                 <properties>                     <propertyGroup caption="Product List">                         <property key="ProductName" type="string" defaultValue="defaultString">                             <caption>Product Name</caption>                             <description>Name Of Product</description>                         </property>                         <property key="Price" type="decimal" defaultValue="0.0">                             <caption>Price Value</caption>                             <description>Value of Price</description>                         </property>                         <property key="ref" type="association" selectableObjects="objectsDatasource">                             <caption>Reference</caption>                             <description>Reference</description>                             <associationTypes>                                 <associationType name="Reference" />                                 <associationType name="ReferenceSet" />                             </associationTypes>                         </property>                           <property key="objectsDatasource" type="datasource" isList="true">                             <caption>Selectable objects</caption>                             <description />                         </property>                     </propertyGroup>                 </properties>             </property>             <property key="Sales" type="object" isList="true">                 <caption>Sales</caption>                 <description>List of Sales</description>                 <properties>                     <propertyGroup caption="Sales List">                         <property key="SalesDate" type="string" defaultValue="string date">                             <caption>Sales Date</caption>                             <description>Date Of Sale</description>                         </property>                         <property key="amount" type="decimal" defaultValue="0.0">                             <caption>Amount of sales</caption>                             <description>Amount of sales</description>                         </property>                     </propertyGroup>                 </properties>             </property>         </propertyGroup>     </properties>   What I’m trying to do is link the Sales info to each Product item, the above gives me this   and I can’t link the sales to product.
1 answers

Can’t you just add the Sales entity as XML Type=datasource in the widget XML and then configure the Product name as an attribute of this datasource? 

In that way you should be able to process and show associated Sales and Product data within your widget.


If that doesn’t work create a non persistent entity which has exactly the attributes from both the Sales and Products entity which you need. Create a microflow or nanoflow to create these non persistent entities out of the persistent Sales and Product entity and feed this new non persistent denormalized entity to your Pluggable widget.


EDIT: I just tested the first scenario and that works. So, make sure you get the correct Sales entities via correct datasource and then select the Product attributes over association via configured type=”attribute” in the widget XML.