April 29, 201411 yr Good Morning all, I need to come up with a way to make an item and total qty be auto consumed by a value that the user enters. example item abcde has 152 qty's. if I type 10 into a field I need the script to create 16 lines. each line will have abcde 10, except for the last one that will have 2 as the qty. Any ideas of examples I should look at. thank you
April 29, 201411 yr We need some table/field names here, so assuming an OrderItems table with fields for: • OrderItemID (auto-entered serial) • Qty (152) • PackSize (10) and a PackSlips table with fields for: • PackSlipID (auto-entered serial) • OrderItemID • Qty the script could do something like (untested): Set Variable [ $itemID; OrderItems::OrderItemID ] Set Variable [ $itemQty; OrderItems::Qty ] Set Variable [ $packSize; OrderItems::PackSize ] Go to Layout [ PackSlips ] Loop Exit Loop If [ not $itemQty ] Set Variable [ $qty; Min ($packSize ; $itemQty) ] New Record Set Field [ PackSlips::OrderItemID; $itemID ] Set Field [ PackSlips::Qty; $qty ] Set Variable [ $itemQty; $itemQty - $qty) ] End Loop Go to Layout [ original layout ]
Create an account or sign in to comment