Swap Relation Tables (BOM)
With a standard Perfion feature you can select one (or multiple) values on a product. If you want to add “table-like” data to a product with multiple rows and columns in a single feature then you need to use Swap Relation Tables.
They are only visible in the Item Editor and not in the grid. Also note despite then name no Table data types are used!
Example: You manage ingredient lists on food products. For each ingredient on a list, you want to manage name, amount, and percentage.
Step 1: Create the Ingredients base feature
Create a String feature called Ingredients. Make sure it has Selectable and Allow Multiple properties checked. This feature will hold the Name of each ingredient. Make sure it has the relevant Top View Group and View Group as this will determine which tab you see the table on.Step 2: Create value features
Create two Number features called Weight and Percentage. Set Unit to “%” on the Percentage and “g” on the Weight feature.Step 3: Create configuration on the base feature
Create a configuration on the Ingredients feature and add the two value features to the configuration. Consider adding all features to the Item view in the configuration as this will ensure they are all automatically displayed in your table.
Step 4: Add Ingredients to the Product configuration
Open the Product configuration and add the Ingredients featureStep 5: Swap Relation Direction
And now for the trick. If you stopped at Step 4, users would just see a normal selectable Ingredients feature on products. But, when you select Swap Relation Direction from the 3-dot menu to the left of Ingredients in the configuration (web) or via right-click for the context menu (windows), the icon next to Ingredients turns into a table:Product ConfigurationThis indicates that users can now manage ingredients on products in a table structure based on the configuration of the Ingredients feature.
Swap Relation Direction data in Feature Data
The Ingredients feature was created as a selectable feature. This is required for Swap Relation Direction to work. This also means that data can be seen and managed in Feature Data. However: when you “swap“ a selectable feature, you do not create Feature Data in advance. Feature data is created in context of products.
Inheritance is not supported for Swap Relation tables. In addition they are not included when copying a product