AnsweredAssumed Answered

Script Help Needed

Question asked by mgxdigital on Oct 12, 2009
Latest reply on Oct 12, 2009 by mgxdigital


Script Help Needed



I am looking for help writing a script.


I have 3 fields in my database: "job number", "ordered qty" and "finished qty"


Each of my records automatically generates a job number, everything else is filled out.


I'm looking for a script to do the following:


If the "finished qty" is less than the "ordered qty" capture the job number from the record, create a new record and insert the job number plus an hyphen 1.

Then take the finished qty minus the ordered qty from the past record and insert it into the ordered qty field in the new record.

If the finished qty is equal to or more than the ordered qty then do nothing.


Ideally, i would like to have a script to where if the script had already been applied (like the job number already had the hyphen 1 after it) then it would move to hyphen 2, hyphen 3 and so on.


Here is my example.

Job 5000 has 10,000. pieces on it.

We want to ship 5000

So when I click the script button, it will make a new job that has 5000-1 as the job number and 5000 pieces in the ordered qty field.



The main reason for this script is to keep track of partial jobs. This way we could see how many partials were sent off an origonal job and always have the origonal job number attached with the hyphen 1, 2, 3 (showing number of partials)


Any help would be so appreciated. Please!

Thank you.