# Join data sets

## Reference Entities in Read-operation

Initially look what are predefined reference entities linked to main entity. &#x20;

<figure><img src="/files/538814QbOqBZwIuW5IlZ" alt=""><figcaption><p>Get UnitCode details of entity ParrCatalog</p></figcaption></figure>

## Reference entity not included in Entity?

* Do multiple requests and join with Flow script (shown below) or
* Is it possible to add reference to Entity using [IFS Entity Configuration](/flow-ifs-cloud-development-guidelines/flow-development-with-odata/configuration/configuring-projections-in-ifs/custom-projections.md) feature or
* create a [Custom Entity](/flow-ifs-cloud-development-guidelines/flow-development-with-odata/configuration/configuring-projections-in-ifs/custom-entities.md) as a new Projection in IFS and if it is possible to add the needed reference entities or
* explore possibilities provided by [Quick Reports](/flow-ifs-cloud-development-guidelines/flow-development-with-odata/configuration/configuring-projections-in-ifs/quick-reports.md) or [Query Builder](/flow-ifs-cloud-development-guidelines/flow-development-with-odata/configuration/configuring-projections-in-ifs/wip-query-designer.md) to build new custom projections.

## Join Entity Sets in flow

{% hint style="warning" %}
In Flow 6.15 a Flowscript Join function was introduced. Use this instead of the loop in the code example.
{% endhint %}

If several requests are necessary to get the data for the dataset, Flow script can be used to to join data into single Flow table.&#x20;

Example script to join previously read Customer and CustomerAddress entitysets.

The script works on any OData machine step output data structure, you just need to replace the key values in the script.&#x20;

```
customers = outCustomer.Results;
let addresses = outRefCustomerAddresses.Results;
let customerRecEmpty = Empty(outCustomer.Results).FirstOrEmpty();
let adddressTabEmpty = Empty(addresses);
let outTab = empty(*[customer: customerRecEmpty, addresses: adddressTabEmpty]);

for customer in customers {
 let addressesTempTab = addresses where CustomerId = customer.CustomerId;
 set outTab = outTab & [customer: customer, addresses: addressesTempTab];
 set addresses = addresses except where CustomerId = customer.CustomerId;  
 }
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.novacura.com/flow-ifs-cloud-development-guidelines/flow-development-with-odata/implementation/join-data-sets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
