SubmitForm(FraudForm);
// Submits the form 'FraudForm' to its data source. This sends the data entered in the form to the connected SharePoint list (Main table).
If(
CountRows(CBCountryText.SelectedItems) = 0,
// Check if the ComboBox 'CBCountryText' has no selected items. If no country is selected, then:
Patch(
'Main Table',
// 'Main Table' is the name of the data source (SharePoint list).
LookUp('Main Table', ID = FraudForm.LastSubmit.ID),
// Use the LookUp function to find the record in 'Main Table' where the ID matches the ID of the last submitted item in 'FraudForm'.
{Countrytext: varOriginalCountry}
// Update the 'Countrytext' field with the value stored in the variable 'varOriginalCountry' (Visible property of the screen : Set(varOriginalCountry,Gallery1.Selected.Countrytext)
)
);
If(
CountRows(CBHotelCode_1.SelectedItems) = 0,
// Check if the ComboBox 'CBHotelCode_1' has no selected items. If no hotel code is selected, then:
Patch(
'Main Table',
// 'Main Table' is the data source that you're updating.
LookUp('Main Table', ID = FraudForm.LastSubmit.ID),
// Use LookUp to find the record in 'Main Table' where the ID matches the last submitted form ID.
{'Hotel code': varOriginalHotelCode}
// Update the 'Hotel code' field with the value stored in the variable 'varOriginalHotelCode' (Visible property of the screen : Set(varOriginalHotelCode,Gallery1.Selected.'Hotel code')
)
);
The patch function was just to try and find a way around the problem when not having enabled the multi select in SP