Using an element inside a calculation

wouter.galia

New Member
Hi

I use a calc element to subtract a percentage of an element. In this working example, I subtract a discount of '50%'. The percentage should be replaced by the value of an element (tablename___discount).

return (float)'{tablename___element}' * ((100-50) / 100);

Could you give me any advice in how to do this?

Best regards
 
It's the same
return (float)'{tablename___element}' * ((100-(int)'{tablename___discount}' ) / 100);

Depending on your element type you may use '{tablename___discount_raw}', this is fetching the value as it will be stored in the DB, without _raw it's the label shown to the user.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top