Combining multiple entities into one component
In the following rule, entities that occur in the same table row but originate from different columns are combined into a single component by using the 'joiningFromSameTableRow' method.
rule "GrowthRate.0.0: Furry Friends" when $tableEntries: List() from collect (Entity(type == "test_species" || type == "growth_rate")) then componentCreationService.joiningFromSameTableRow("Characters.0.0", "Furry_Friends", $tableEntries); end
Syntax | Explanation |
---|---|
rule "GrowthRate.0.0" | Name of the rule Each rule must have a unique name. For further information, please see Rule naming. |
$tableEntries: List() from collect (Entity(type == "test_species" || type == "growth_rate")) | Collects a list of entries from entities “Test Species“ and "Growth Rate". |
componentCreationService | Invokes the class responsible for component construction. |
.joiningFromSameTableRow("GrowthRate.0.0", "Growth_Rate", $tableEntries); | The "joiningFromSameTable Row" method is used to create a component combining values from entities that are located in the same table row. |
Notice
For further information about the methods listed in the table, please refer to the relevant sections in the Javadoc documentation:
Following the rule execution, you will be able to observe the following outcomes in the component list:

Result in the component list
Learn how to write a entity rule that extracts two types of entities from two table columns: Extract from a table