1 Reply Latest reply on Sep 17, 2012 9:26 AM by philmodjunk

    Add Quantity to Same Fields in Found Set

    CoreyWiley

      Title

      Add Quantity to Same Fields in Found Set

      Post

           We would like to "+1" to the "Amount in Stock" amount in a found set.

            

           We've set a variable so far, but want to, with the click of a button: find whichever category we need at that time, add 1 to the current amount for all the "Amount in Stock" for the current found set. There will be multiple categories by the time we are fully set up.

            

           Screen shot attached. Thank you!

            

      Picture_4.png

        • 1. Re: Add Quantity to Same Fields in Found Set
          philmodjunk

               Your script doesn't find records and only modifies the value for whatever records is current at the time the script is performed. Do you want the script to perform the find to get the found set of records you want to update by incrementing the amount in stock field?

               BTW, this won't fix the issue for you here, but instead of using the variable like you have you can replace the first two lines with:

               Set Field [ Line Items::amount in stock ; Line Items::amount in stock + 1 ]

               and you'll get the same result.

               and note that I did not put the 1 in quotes either.

               But if you want to update all the records in a found set, you don't need to use Set Field at all. You can use Replace Field Contents with the Calculation option written like this:

               Replace Field Contents [no dialog; Line Items::amount in stock ; Line Items::amount in stock + 1 ]

               Note that this changes the value of amount in stock for every record in your found set--this could be 100's or even 1000's of records and cannot be undone. Make sure that your script is correctly finding the records you want to update first and make back up copies of your file before testing such a script so that you can throw out your file and try again with the back up copy if you don't get the results that you expected.