Filter Gallery with Toggles - Ensure your gallery shows only items where a toggle (Toggle_Ship) is enabled.
Filter(InventoryList, Toggle_Ship.Value = true)
You need to write a loop in Power Apps using a ForAll with a nested loop (or recursive Patch approach) to perform FIFO deduction.
✳️ Sample Power Fx logic outline:
// Suppose we have a collection of items to ship, like:
// [{Name:"A", QuantityToShip:11}, {Name:"C", QuantityToShip:2}]
ForAll(colShipList,
With(
{
remainingQty: QuantityToShip,
inventoryItems: Sort(Filter(InventoryList, Name = ThisRecord.Name && Quantity > 0), CreatedDate, Ascending)
},
ForAll(inventoryItems,
If(remainingQty > 0,
With(
{
deductAmount: Min(remainingQty, ThisRecord.Quantity)
},
Patch(InventoryList, ThisRecord, {Quantity: ThisRecord.Quantity - deductAmount});
Set(remainingQty, remainingQty - deductAmount)
)
)
)
)
)
Recurrence (if applicable)
If you want this to happen automatically, use Power Automate (Flow) to:
- Trigger periodically (daily/weekly).
- Read toggled items from SharePoint.
- Perform FIFO deduction via flow logic or call Power Apps function.
🏷️ Please tag me @MS.Ragavendar if you still have any queries related to the solution or issue persists.
✅ Please click Accept as solution if my post helped you solve your issue and help others who will face the similar issue in future.
❤️ Please consider giving it a Like, If the approach was useful in other ways.