Skip to main content
Topic: Calculated field (Read 2018 times) previous topic - next topic

Calculated field

Hello, I am trying to finish a small application: I would like to improve a form where there are several decimal fields, I would like to calculate a field with the values of the other fields. I tried to insert this into events before update
$ modeldata ['Celkom'] = $ modeldata ['Hmotbody'] + $ modeldata ['Srstbody']; without success. In addition I would like to update the field another table with the value of this field. Could someone help me for the sintaxe. Or is this not the right place to achieve the desired result.Thank you

Re: Calculated field

Reply #1
@Josito‍ there are two ways to go about this.
1. you can use ClientEvent to do the calculations using jQuery and populate the Celkom field.
Or
2. The approach you used above, by calculating the sum and assigning it to your Celkom field in Action Before Add.

Note: what you did above should work fine. If you are doing the second one you should hide the sum field from appearing on the add page. If after this you still have issues please send me your TeamViewer ID and Password through a private message on the forum.

 

Re: Calculated field

Reply #2
Hello and thank you Willwin for taking the time to answer. You know, I am not a programmer I just do small programs from time to time for our association of amateur breeders and this fact I quickly forget about sintaxe. I will deepen my knowledge in this sense to be able to use PHPRAD better than I will order the classic version. Thanks again.