I have a collection of records, and a collection of selected records from that first collection.
My intent is to have a form that will update all the selected records in the first collection with the values from the form, depending on if a value was entered into the form or not.
This works with textboxes but when I try to update one of the fields (a multi-select choice field, so a table of "Value") I get two different problems:
- Around 1 in every 5 times it will instead create a new blank record in the collection holding only that one multiple choice field
- Another 1/5 chance of nothing happening at all
The code that works 3/5 times and breaks in two different ways is something like this:
With({ newItems: cmbNewAddItem.SelectedItems },
UpdateIf(colPurchaseItems, Index in colSelections.Index, {
Quantity: Coalesce(Value(txtNewEditQuantity.Text), Quantity),
ActualPrice: Coalesce(Value(txtNewEditPrice.Text), ActualPrice),
GL: Coalesce(Value(txtNewEditGL.Text), GL),
Items: If(CountRows(newItems) > 0,
newItems,
Items
)
})
)