You need to sign in to do that
Don't have an account?
Zack Thomas
Calculating field value inside a repeat tag
My problem is that I need to be able to calculate the multiplicative result of two fields inside the loop and then display that result in an outputText field.
The first thing I tried was to see if it was possible to multiply the two fields together inside the SOQL statement and have the result inside the result set, but SOQL doesn't seem to support that. The next thing I tried was to see if I could make a call back to the Apex code I'm using as an extension to multiply the fields as they're rendered, but there doesn't seem to be a way to make a function call such as that from visualforce. The next thought was to possibly use a javascript call to multiply and render client-side, but there doesn't seem to be any intuitive way to accomplish that either.
Am I on the wrong train of thought? Did I miss something? Or is there merely no feasible way at this point in time to accomplish anything such as this?
Thanks!
The first thing I tried was to see if it was possible to multiply the two fields together inside the SOQL statement and have the result inside the result set, but SOQL doesn't seem to support that. The next thing I tried was to see if I could make a call back to the Apex code I'm using as an extension to multiply the fields as they're rendered, but there doesn't seem to be a way to make a function call such as that from visualforce. The next thought was to possibly use a javascript call to multiply and render client-side, but there doesn't seem to be any intuitive way to accomplish that either.
Am I on the wrong train of thought? Did I miss something? Or is there merely no feasible way at this point in time to accomplish anything such as this?
Thanks!
today I can do :
<apex:outputText value="{!oli.Discounted_Price__c}"/>
Is there a way to use a subtract function on the page?
<apex:outputText value="javascript:subtract({!oli.Total__c},{!oli.Discount__c})"/>
Am I missing some simple way to use javascript to control values?