0

All, I'm getting a strange error on my VF page that I can't figure out. 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:variable value="{!0}" var="RunningBalance"/>

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

                <table>   
                <apex:variable value="{!0}" var="RunningBalance"/>
                <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>

</apex:page>

As requested, here is my controller:

   public class Invoice {
       public ApexPages.StandardController stdCntrlr {get; set;}
       public List<Client_Billing__c> billingList {get;set;}
       public List<Client_Billing__c> tempbillingList {get;set;}
       public List<AECaseMgmt__Program_Case__c> CaseQueryResults {get;set;}
       public AECaseMgmt__Program_Case__c Clientcase {get;set;}
       public Map <id,List<Client_Billing__c>> mapCaseToBilling {get;set;}       


public Invoice(ApexPages.StandardController controller) {
    stdCntrlr = controller;
    mapCaseToBilling = new map <id, List<Client_Billing__c>>();

 for (Client_Billing__c record: [Select Client_Case__c, Miles__c, Name, Amount__c, Client_Case__r.Name, Client_Case__r.Program__r.name, Amount_Credit_Debit__c, Date__c, Transaction_Description__c 
                                 from  Client_Billing__c])  
    {
        if (!mapCaseToBilling.containsKey(record.Client_Case__c))
            mapCaseToBilling.put(record.Client_Case__c, new List<Client_Billing__c>());
        mapCaseToBilling.get(record.Client_Case__c).add(record);

    }
 }
3
  • are there any outputlabels in page? Jun 21, 2017 at 15:57
  • also can you share controller and a debug of value RunningBalance Jun 21, 2017 at 16:00
  • No outputlabels. I'm not sure how to get a debug value of an apex variable in the visualforce page, but glad to learn if you can instruct me.
    – user45444
    Jun 21, 2017 at 16:15

2 Answers 2

0

This is a strange issue and related to using a repeat variable as the key to the map - {!map[key]}. Some got success by changing the key and level.

See here and here

Please try to change the var or key and see the result. Best is to log a case with Salesforce.

4
  • Good feedback. Changing the variables, labels, etc didn't help but good to know that its a Salesforce issue. Our little nonprofit org doesn't have access to premiere support, so if others have found workarounds for this, please let me know.
    – user45444
    Jun 21, 2017 at 17:51
  • Use wrapper class and then show it on VF page Jun 21, 2017 at 18:51
  • Thanks, Avijit. Could you give me a little more guidance on that? Are you suggesting not using the mapping structure?
    – user45444
    Jun 21, 2017 at 23:13
  • I have used Map many times for VF pages. Wrapper class is alternative as salesforce support need some time for your org. Please contact your salesforce appointed account manager and escalate this case. to get help on wrapper class see this developer.salesforce.com/page/Wrapper_Class Jun 22, 2017 at 0:55
0

Thanks again, Avijit, for the feedback. In addition to reaching out to Salesforce, I tried the wrapper class solution and here's what I came up with. Seems to be working, but would love feedback on if there is a cleaner/more efficient way to do it:

public class Invoice_nomap {
    public ApexPages.StandardController stdCntrlr {get; set;}
    public list <CasewInvoices> caselist {get; set;}
    public list <Client_Billing__c> tempinvoicelist {get; set;}

public Invoice_nomap(ApexPages.StandardController controller) {
    stdCntrlr = controller;
    if (caselist==null){
        caselist = new List <CasewInvoices>();
        }

    tempinvoicelist = [Select ID, Client_Case__c, Name, Amount__c from Client_Billing__c]; 

    for (AECaseMgmt__Program_Case__c  record: [Select ID from  AECaseMgmt__Program_Case__c 
                                               where Id IN (SELECT Client_Case__c FROM Client_Billing__c)])  
    {
        caselist.add(New CasewInvoices (record));
    }

    for (CasewInvoices caseincrement:caselist)
    {
        for(Integer i = 0; i <tempinvoicelist.size(); i++){
            if (tempinvoicelist[i].client_case__c ==caseincrement.clientcase.id)
                {
                    caseincrement.billinglist.add (tempinvoicelist[i]);
                }
        }
    }

 }

    Public class CasewInvoices{
    public List<Client_Billing__c> billingList {get;set;}
    Public AECaseMgmt__Program_Case__c Clientcase {get;set;}

        public CasewInvoices (AECaseMgmt__Program_Case__c cc)
        {
            Clientcase = cc;
            billingList = new list<Client_Billing__c>();
        }
    }
}  

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .