You need to sign in to do that
Don't have an account?
Sugandhi Verma
Help!!!!!! adding field values using apex:variable
Hiii,
I am adding the field value with the apex:variable but getting the error--"Incorrect parameter type for operator '+'. Expected Text, received Number" Below is my code,please helppp:
I am adding the field value with the apex:variable but getting the error--"Incorrect parameter type for operator '+'. Expected Text, received Number" Below is my code,please helppp:
<apex:variable value="{!0.00}" var="total1"/> <apex:pageBlock > <apex:pageBlockTable title="Your Item" value="{!selectedWrapperList}" var="wrapRec" rendered="{!selectedList}" > <apex:column value="{!wrapRec.Name}" /> <apex:column ><apex:outputField value="{!wrapRec.T_Price__c}" /> <apex:variable var="total1" value="{! total1 + wrapRec.T_Price__c}" /> <!-- Footer of the first Cell -->> <apex:facet name="footer"> Total:{!total1} <span class="t1"></span> </apex:facet> </apex:column> </apex:pageBlockTable> </apex:pageBlock> <script> document.getElementsByClassName('t1')[0].innerHTML = '{!total1}'; </script>
Use the below code
Donot forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help
It's Java datatype Conversion method.It is not working in the apex:variable statement.
Error-Unknown function "String.ValueOf"
Pasete controller sample code here.
my controller contained the above code...
1. & - Ampersand character to concatenate 2 strings.
2. TEXT() - To convert a number to string.
3. VALUE() - To convert a string to number.
You may use any function available in Formula Fields in VF Merge Fields (except a few).
Note:<apex:variable> does not support reassignment inside of an iteration component, such as <apex:dataTable> or <apex:repeat>. The result of doing so, e.g., incrementing the <apex:variable> as a counter, is unsupported and undefined.
And you are trying to use it inside of an iteration
Have a look on the documentation
https://www.salesforce.com/docs/developer/pages/Content/pages_compref_variable.htm
Donot forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help
It's showing the wrong results as i am adding a field of number type and a variable in value attribute.
Actually this code is working fine...m using this concept..
my class is:
The variable 'total1' is of Object type, logically you need to convert it to a decimal before adding.
So {!(VALUE(total1) + wrapRec.T_Price__c)} or {!(VALUE(TEXT(total1)) + wrapRec.T_Price__c)} may work.
Disclaimer : I have not really tried this on a Page but this seems logical, if addition can happen in the value attribute.
I have tried that also but it's not working.
number1__c and T_Price__c
Is there any difference.