+ Start a Discussion
Collen Mayer 6Collen Mayer 6 

Problem Displaying Apex Variable in VF page

Hello all,
I"m trying to use an apex variable in my visualforce page to keep a running total of a client's balance on a custom object.  I'm getting a strange error "the value 'core.apexpages.el.adapters.RuntimeTypeMetadataElAdapter@75251df1' is not a valid number."  I think it may have something to do with how I'm referring to the map field but can't figure out how to do it differently.  I have verified that my controller is functioning properly, that records are populating, etc.  I only get the error when trying to display the variable; if I delete the "OutputText" tag, the error goes away which seems strange to me. 

Here's a trimmed down version of my Visualforce code that reproduces the error:
 
<apex:page standardController="AECaseMgmt__Program_Case__c" extensions="Invoice"   sidebar="false" showHeader="false" >
   
   <apex:repeat value="{!MapCasetoBilling}" var="Key">

        	<apex:variable value="{!0}" var="RunningBalance"/>
       			<table>   
                   <apex:repeat value="{!MapCasetoBilling[Key]}" var="BillingItem">
                        <apex:variable value="{!0}" var="RunningBalance"/>

                	<apex:variable var="RunningBalance" value="{!BillingItem['Amount_Credit_Debit__c']+RunningBalance}"/>
                       <apex:outputText value="{!RunningBalance}"/><br/>

            	</apex:repeat>
       		</table>
             </apex:repeat>
</apex:page>
Thanks,
Collen
 
Raj VakatiRaj Vakati
Hi Collen , 
In your code, you used to varable inside repeat. Just try like below 
 
<apex:variable value="{!0}" var="RunningBalance"/>

				<apex:repeat value="{!MapCasetoBilling}" var="Key">

					<table>   
					<apex:variable value="{!0}" var="RunningBalanceTem"/>
					<apex:repeat value="{!MapCasetoBilling[Key]}" var="BillingItem">
                    	<apex:variable var="RunningBalance" value="{!BillingItem['Amount_Credit_Debit__c']+RunningBalance}"/>
                       <apex:outputText value="{!RunningBalance}"/><br/>

            	</apex:repeat>
       		</table>
             </apex:repeat>

 
Collen Mayer 6Collen Mayer 6
Thanks, for the response.  You are right that I had my declaration in the wrong place, but with your code I still get the error about not being a valid number.

Other thoughts?