3 Replies Latest reply on Aug 9, 2017 8:02 AM by philmodjunk

    Changing calculate field value




      Suppose I have the follow table and field structure:


      Table A

        Field A,B,C

           Field C is a calculate field where A are multiplied by B.


          What I need is to change the value of field C by hand if I don't like the result of the calculation.


           Since field C can't be modified because is a calculation filed.

           I tried to setup a new field D where D is a number field and setup the auto enter a calculation where the field D is equal to field C. and check the don't overrigth if there is a value. So I can change the value if I want and clear the field to show the calculated value, but....

           But the field keep always empty.




      Best regards,




      PS. Sorry for my English.....

        • 1. Re: Changing calculate field value

          If ( isempty ( D ) ; A * B ; D )


          but you might also try just A  * B as your auto-enter calculation since such a field is modifiable.

          • 2. Re: Changing calculate field value



              I alredy did that. But only display the value on the creation of a new record.

              Explain something. The auto calculation enter is made only on the creation of the record ? If so.

              How can I  auto update the field during or after change the fields inside the record ?  I only did that setting the field to calculation, but then I can’t change it.

            I try to refresh the window but don't recalc the field.


            I try to set field D = field A where A is a calculation field but display a a empty field.

            i set field D as calculation and If ( isempty ( D ) ; A * B ; D ) and display a ?





            • 3. Re: Changing calculate field value

              i set field D as calculation and If ( isempty ( D ) ; A * B ; D ) and display a ?


              Try clicking into the field and see if the value displays correctly. If so, your field is too small to display the value returned and you need to make the field wider. The other possibility is a calculation error such as divide by zero, but A * B isn't likely to produce that error so that isn't possible unless fields A, B or D were defined as calculation fields and they produced the error in the first place.


              My first example works either as a field of type calculation or a number field with an auto-enter calculation where "do not replace existing value" is not selected.


              If "do not replace existing value (if any)" is not checked, the field will update any time one of the referenced fields is changed as well as when the record is created. If you want to updated existing records after adding or changing an auto-enter calculation, however, you have to use other means to put the needed value into the records that existed before you made that change.


              I suggested that you try A * B as an auto-enter calculation as it might or might not work for what you need given it's update behavior. Test with the "Do not replace..." check box cleared as well as uncleared to see if either setting works for you.


              You can use replace field contents with your calculation used with the calculation option to do that one time update. In some cases, you can also temporarily change the field to type calculation, exit manage database, then change the field back to number with an auto-enter calculation. FileMaker preserves your expression as you make these changes so this is easy to do.