I need a calculated field that is the product of 2 other fields in the same table. The fields is Total
, which is equal to Price
* Quantity
in an Stock table.
Would someone provide an example, please?
You probably want a computed field:
Field('total', compute=lambda r: r.price * r.quantity)
Depending on your needs, you might also consider a virtual field.