Forum Discussion
reynaldo_malave
2 years agoHelper III
Inventory Repostion for Picking
Hi guys, I been stuck on this for a couple of days now. Using power query I am working on a picking line inventory restocking. The whole idea is to get products on the picking line on certain ord...
- 2 years ago
hi, reynaldo_malave try this
let Source = your_table, recs = List.Buffer(Table.ToRecords(Source)), count = List.Count(recs), g = List.Generate( () => [i = 0, Productold = recs{0}[ProductoId], Available = recs{0}[Available], Restocking = recs{0}[RestockingNeed], Restock = List.Min({Restocking, Available})], (x) => x[i] < count, (x) => [i = x[i] + 1, Productold = recs{i}[ProductoId], Available = recs{i}[Available], Restocking = List.Max({0, x[Restocking] - x[Restock]}), Restock = List.Min({Available, Restocking})] ), z = Table.RemoveColumns(Table.FromRecords(g), {"i"}) in z
AlienSx
2 years agoSuper User
hi, reynaldo_malave try this
let
Source = your_table,
recs = List.Buffer(Table.ToRecords(Source)),
count = List.Count(recs),
g =
List.Generate(
() =>
[i = 0,
Productold = recs{0}[ProductoId],
Available = recs{0}[Available],
Restocking = recs{0}[RestockingNeed],
Restock = List.Min({Restocking, Available})],
(x) => x[i] < count,
(x) =>
[i = x[i] + 1,
Productold = recs{i}[ProductoId],
Available = recs{i}[Available],
Restocking = List.Max({0, x[Restocking] - x[Restock]}),
Restock = List.Min({Available, Restocking})]
),
z = Table.RemoveColumns(Table.FromRecords(g), {"i"})
in
z
- reynaldo_malave2 years agoHelper III
Thanks AlienSx this worked like a charm 🙂