TotalNumberOfCombinations: Product(Sizes.Count)
--> Multiply together number of small, medium, and large fruits
RowDelta: TotalNumberOfCombinations-[Unique Combinations].N.Max()
--> Compare that number to the number of rows in the combinations table
buttonEnsureCorrectRowCount:
Label: Just gives a readable label for the button to know what it will do
Format("Ensure {1} rows -- {2}", TotalNumberOfCombinations,
SwitchIf(RowDelta=0, "No Rows Needed",
RowDelta<0, "Remove " + RowDelta.AbsoluteValue() + " rows",
RowDelta>0, "Add " + RowDelta + " rows"))
Action: Looks at RowDelta to decide whether to add or remove rows
FormulaMap(Sequence(1, RowDelta.AbsoluteValue()),
SwitchIf(
RowDelta > 0, AddRow([Unique Combinations]),
RowDelta < 0, DeleteRows([Unique Combinations].Filter(N=CurrentValue))) )