3 Replies Latest reply on Oct 20, 2016 8:35 AM by angelden

    Help with calculated field





      Sorry, my English is not good.

      I am new in this of the programming, I try to do the following thing:

      The record ID 4 ,I have introduced it manually. Is it possible to introduce by a script?. For example:

      If an equal ID_Code exists, then to go to the last one ID with this ID_code repeated

      and in Stock to place the calculated field (Stock+In-Out). In the opposite case to place in stock what exists in the field  In.

      Thank you.




        Soy nuevo en esto de la programación, trato de hacer lo siguiente: EL ID 4 de registro, lo he introducido a mano. ¿Es posible introducir mediante script?. Por ejemplo: Si ID_Code ya existe, entonces ir al último ID con este ID_code repetido y en Stock colocar el siguiente cálculo (Stock+In-Out). En el caso contrario colocar en Stock lo que hay en la celda In.

      1. Gracias.



        • 1. Re: Help with calculated field

          Please post again in another language if that would help you more.


          Sent from miPhone

          • 2. Re: Help with calculated field

            I can suggest two options.


            1. Use a relationship that matches by ID_Code to match to the one record with this value. In a script, Set Field can then update the In or Out fields to show an inventory change. A script might also perform a find for this record, but a relationship seems better to me.
            2. Use an "Inventory Ledger" approach where you use a basic Bookkeeping method to track inventory changes. Each time that you add or remove inventory, you create a new record with the ID_Code and an amount to enter in either the In or Out fields. You then use either a summary field (and sort your records by ID_Code) or a relationship that matches by ID_Code to compute the Sum of all of these inventory changes to get the current amount in inventory.


            Both methods would require defining a "Balance" calculation field defined as: In - Out


            You might find this thread on creating an Inventory Ledger useful to you.

            • 3. Re: Help with calculated field

              Thanks very much, I tri it.