search and/or combine lists from two different entities

i have two entities in which i use a microflow to pull data from different mySQL tables to feed the lists for each entity.  entity 1: invoices entity 2: company simar as above but pulls from a different mysql table. attributes: cardcode, companyName   in each list there is the “cardcode” attribute/column. i want to use this attribute to show the company name on the datagrid for the invoices. on my domain model there is an association between the two entities, but i cannot figure out how to reference the cardcode to find the correct company name. not sure if this needs to be noted, but on my invoice datagrid2 it uses the above microflow to populate the datagrid data.   i’ve tried different tactics but cannot figure out if this needs to be done on the datagrid on in its own microflow since i only need one column to be referenced from the company entity can somebody please help or point me to a learning path that can help? thanks!
1 answers


You will need to do a bit of work before you can display these together in a datagrid.  You have created the association between Invoices and Company, you just need to populate it.  You can do this by in a microflow like this:

  • loop through the list of invoices
  • inside the loop, retrieve the Company whose cardcode is the same as the invoice.  The Xpath in your retrieve would be something like [cardcode = $IteratorInvoices/cardcode]
  • after this retrieve, change the object $IteratorInvoices, set the value of the association to the retrieved Company

One note:  if you just use a standard retrieve in the second step, you’ll get a list of Companies (even if that list only has one member).  To prevent this, click the First button inside of your Retrieve.

After setting the value of the association, in the Datagrid2 you won’t need to have a nested dataview in the first column, you can retrieve the company via the association.

Hope that helps,