Can we use math expression in Field collection I have two fields in field collection i.e total_amount and installment_value. I want to divide total_amount with installment_value and display result in Result field. Can somebody resolve this issue for me as I tried with computed and math expression but unable to resolve the issue. Thanks
First off, would this be for D7 or D8? I'm assuming you're using the node entity. I would think a good approach is to have the result field as a field on your node, make the calculation, and set the value in a hook_node_presave() (for D7, hook_entity_presave() for D8). At this point, the values are about to be stored to your DB, so you'd have access to your total_amount and installment_value values, and you can set your third "result" field to this computed value. You'd probably want to set the "result" field to not be visible to the end user, by setting it's #access to false in a hook_form_alter(), since anything they input would be overridden by your calculation anyway. I could provide you a more detailed answer if you can clarify which version you're on, or hopefully this can get you going in the right direction!