You need to sign in to do that
Don't have an account?
Collen Mayer 6
Problems with Map/List for nested for loop
Hi All,
I'm working on a visualforce controller to produce multiple invoices, for any client case that has billing items. Each billing item has exactly one client case (each client case may have one or more billing items). I'm getting stuck on the map line below. Currently I am getting the error, "Incompatible list type List for putAll on Map>". I'm assuming I can't use putAll in this case? Can someone suggest an alternative of how this might be done? Any help, suggestions, improvements are appreciated.
Thanks,
Collen
I'm working on a visualforce controller to produce multiple invoices, for any client case that has billing items. Each billing item has exactly one client case (each client case may have one or more billing items). I'm getting stuck on the map line below. Currently I am getting the error, "Incompatible list type List for putAll on Map>". I'm assuming I can't use putAll in this case? Can someone suggest an alternative of how this might be done? Any help, suggestions, improvements are appreciated.
Thanks,
Collen
public class Invoice { public ApexPages.StandardController stdCntrlr {get; set;} public List<Client_Billing__c> billingList {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; public list <BillingEntry> caseList {get; set;} public Invoice(ApexPages.StandardController controller) { stdCntrlr = controller; mapCaseToBilling = new map <id, List<Client_Billing__c>>(); mapCaseToBilling.putAll([Select id, (Select id, Client_Case__c from Billing_Items__r) from AECaseMgmt__Program_Case__c WHERE Id IN :mapCaseToBilling.keySet()]); for(AECaseMgmt__Program_Case__c cc : CaseQueryResults) { BillingEntry be = new BillingEntry (cc); for (Client_Billing__c cb: mapCaseToBilling.get(cc.Id)) { be.billingList.add(cb); } } } Public class BillingEntry { public List<Client_Billing__c> billingList {get;set;} Public AECaseMgmt__Program_Case__c Clientcase {get;set;} public BillingEntry (AECaseMgmt__Program_Case__c cc) { Clientcase = cc; billingList = new list<Client_Billing__c>(); } } }
You Can put your value in with this way. marked best if this was help full else let know .
Thank you
Avaneesh Singh
change to
May be it works.
But since I"im in a nested for loop, I need to get the SQL statement out of both for loops. Can you suggest how I might do that?
Thanks,
Collen