How to flatten composite records from Rest Source when you have single or multiple composite outputs available in Rest Source

How to flatten composite records from Rest Source

Many real-world applications need to handle data structures which can't be represented with a simple flat table. A good example is an invoice record where each record contains a sub-list of line item records. For each main object, which identifies the customer invoice, there can be any number of child records, which identify each of the items being billed. These child records are also known as composite records.
Action:

When Rest Source have outputs for composite records and needed to be flatten to have them with the main objects in one table:

Solution:
  1. In Rest Source, Go to columns tab and choose the composite records output.
  2. Then verify if all the columns are check marked or not. If not then you need to check marked all the columns. See below screen capture for reference where there is only single composite record output available. 


If only single composite record ouput available:

  1. Choose the composite record output from drop down list and then make sure all the columns are check marked. If not then you need to manually check marked all the columns. See below screen capture where the composite record output has been selected and the child records columns are initially unchecked highlighted yellow.


  1. Check mark all the columns as mentioned in the below screen capture, So they are available at the destination when we connect source to destination.


  1. Connect Rest Source with Destination and choose the output that contains composite record. See below screen capture for reference.


  1. Now you will have the composite records flatten with the main objects. 

If  multiple composite record ouputs are available:

  1. If you have multiple composite record outputs available in the drop down list then choose each composite output and check mark all the columns that are initially unchecked.
  2. Then using merge join you can join composite records into one flatten table as mentioned in the below screen capture.


The composite record output contains not only fields from the composite record, but also the parent records. The output will be populated with sets of rows, one set for each parent record. Each set of rows is separated with blank row (all NULLs).