
Hi,
My data source consists of two columns, "Date" and "FoodName".
If I want to Edit existing information then I go to my BrowseGallery and then -> select a specific row -> and then edit it - easy.
But what if I am not coming from BrowseGallery and have not selected a specific row? What I want is a Form where I can fill in FoodName and then select a Date (and row ID if necessary) and then it replaces existing data.
Sincerely,
Kudy
Hi @Kudratilla,
A possibility that comes to mind uses a variable:
In the OnChange property of the field where the user can type the FoodName, set the following formula:
With({
_Item: LookUp(
DataSourceName,
FoodName = Self.Text
)},
If(
IsBlank(_Item),
NewForm(FormName);
Set(
varEditRecord,
Blank()
),
EditForm(FormName);
Set(
varEditRecord,
_Item
)
)
)
Then set the Item property of the form to varEditRecord.
Since this will break the reference to the gallery, you'll need to insert the below in the OnSelect property of (a control in?) your gallery to make things work again:
EditForm(FormName);
Set(
varEditRecord,
ThisItem
);
You should be careful with this though, because any typo will create a new record and pollute your data.