Here is a script that creates the new data table you want;
Names Default To Here( 1 );
dt = Data Table( "Part A Inventory Data" );
dtRpt = New Table( "Output Report",
Add Rows( N Rows( dt ) ),
New Column( "Week", set each value( Row() ) ),
New Column( "Inventory on Hand" ),
New Column( "Consumption", set each value( dt:Number of pieces consumed[Row()] ) ),
New Column( "Total" ),
New Column( "Place Order", character ),
New Column( "Order Arrives", character )
);
Current Data Table( dtRpt );
StartingIOH = 3637;
For( i = 1, i <= N Rows( dtRpt ), i++,
If( i == 1,
:"Inventory On Hand"n[i] = StartingIOH,
:"Inventory On Hand"n[i] = :Total[i - 1]
);
If( :"Order Arrives"n[i] == "",
:"Order Arrives"n[i] = "N"
);
:Total[i] = :"Inventory On Hand"n[i] - :Consumption[i];
If( :"Order Arrives"n[i] == "Y",
:Total[i] += 600
);
If( :Total[i] < 1510,
:"Place Order"n[i] = "Yes";
:"Order Arrives"n[i + 2] = "Y";
,
:"Place Order"n[i] = "No"
);
);
There appears to be a discrepancy around line 22 in your report table. You specify to order new parts, however, you report them arrived in one week, not in 2 weeks. My script sets the arrival week based upon your specification of a 2 week order lag.
Jim