In Need of a Script
I have a handful of clients that run into the same problem repeatedly. CI_item and IM_ItemWarehouse get updated with crazy huge positive and negative numbers for average cost and total value. Pretty sure this has to do with doing bill of materials production entry when the raw materials are not in stock. But nonetheless I'm asked on a regular basis to fix these things and the only way I know how is to export to Excel, search for the wayward numbers and use DFDM to fix them manually.
Back in the day when you could get into the interpreter and write code, I would've written a quickie program to do this. Is there a way that a script can be written In versions 4.3, 4.4 or 4.5 to make the corrections?
I hope you can understand my pseudocode, this is what I would want to do.
SCRIPT ONE
Open CI_Item
:LOOP
read record from CI_item
if CI_Item:Valuation = 1 and CI_Item:ItemType = 1 {item is standard cost and regular item}
then
Let CI_Item:AverageUnitCost = CI_Item:StandardUnitCost
Let CI_Item:TotalInventoryValue = CI_Item:StandardUnitCost *CI_Item:TotalQuantityOnHand
write record
else
goto LOOP
SCRIPT TWO
Open CI_Item
open IM_ItemWarehouse
:LOOP
read record from IM_item warehouse
lookup IM_Warehouse:ItemCode from CI_Item
if CI_Item:Valuation = 1 and CI_Item:ItemType = 1
then
let IM_ItemWarehouse:AverageCost = CI_Item:StandardUnitCost
let IM_ItemWarehouse:TotalWarehouseValue = IM_ItemWarehouse:AverageCost * IM_ItemWarehouse:QuantityOnHand
write record
else
goto LOOP