Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3860 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

 

 

Posted

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 ]
  • Like 1

This topic is 3860 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.