Icon

Inventory Cover

This workflow demonstrates the usage of a recursive loop for inventory cover calculation.
The algorithm calculates the cover for an inventory. For each week, we have end inventory and consumption and calculate the number of weeks the end inventory lasts.

We do this by going through the table row by row and each time:
- We check if it is the last row. If yes, we return 0.
- Otherwise, we take the cumulative sum of the consumption in the following weeks and
- count the number of weeks the inventory lasts.
- If at the end a fraction is left, we calculate that as well as (end inventory - consumption until then) / consumption of next week

This algorithm calculates the cover for an inventory. For each week, we have end inventory andconsumption and calculate the number of weeks the end inventory lasts.We do this by going through the table row by row and each time:- We check if it is the last row. If yes, we return 0.- Otherwise, we take the cumulative sum of the consumption in the following weeks and- count the number of weeks the inventory lasts.- If at the end a fraction is left, we calculate that as well as (end inventory - consumption until then) /consumption of next week Example dataEnding Inv neededfor row splitterAdd coverSend back data without first rowCollect rows with coverFirst rowvs restLast iteration?Top: first iterationsBottom: last iteration Table Creator RecursiveLoop Start Table Rowto Variable Variable toTable Column Recursive Loop End Row Splitter Empty Table Switch CASE Switch End Last Iteration Non-last Iterations This algorithm calculates the cover for an inventory. For each week, we have end inventory andconsumption and calculate the number of weeks the end inventory lasts.We do this by going through the table row by row and each time:- We check if it is the last row. If yes, we return 0.- Otherwise, we take the cumulative sum of the consumption in the following weeks and- count the number of weeks the inventory lasts.- If at the end a fraction is left, we calculate that as well as (end inventory - consumption until then) /consumption of next week Example dataEnding Inv neededfor row splitterAdd coverSend back data without first rowCollect rows with coverFirst rowvs restLast iteration?Top: first iterationsBottom: last iterationTable Creator RecursiveLoop Start Table Rowto Variable Variable toTable Column Recursive Loop End Row Splitter Empty Table Switch CASE Switch End Last Iteration Non-last Iterations

Nodes

Extensions

Links