I have 2 data sources namely, try1 and Try 22 in ms lists,
I am having issues with deducting the quantity in try1 from Try22, it is like an inventory system where a user can log an item and then the quantity the user asked will be deducted from the datasource(try1), I used Try22 for logging an item while try1 are used for storing the items. It should be done by clicking a Save button to proceed.
Here is my code for button On Select:
ForAll(
Filter(
Gallery2.AllItems,
Toggle3.Value = true
),
Patch( try1, First(Filter(try1, txtItemAdm.Text = Item )),
{
Quantity : LookUp(try1, Item = txtItemAdm.Text, Quantity) - Value(txtQtyLog.Text)
}
));
ForAll(
Filter(
Gallery2.AllItems,
Toggle3.Value = true
),
Patch(
Try22,
ThisRecord,
{
Title: lblLogID.Text,
Item: Dropdown1.SelectedText.Item,
Quantity: Value(txtQtyLog.Text),
Date: Value(DatePicker1.SelectedDate),
AssignedBy: Office365Users.MyProfileV2().displayName,
Assigned: ComboBox2.Selected.DisplayName
}
)
);
The issue in my code is that it is only updating the last record in the try1 datasource even if other item is selected from dropdown list.