function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RarLopzRarLopz 

Method does not exist or incorrect signature: void add(Id, String) from the type Map<Id,String>​​​​​​​

I am trying to optimize my working code. When i tried to convert a set into a Map, I am getting an error -  
Line: 10, Column: 22
Method does not exist or incorrect signature: void add(Id, String) from the type Map<Id,String>

 
Map<ID, String>  mapAccountBillingAddress = new Map<ID, String>();
for (AggregateResult aggregate : [Select count(Id),BillingStreet str,BillingCity ct, BillingState stt, BillingPostalCode pc 
From Account                                                                Group By BillingStreet,BillingCity,BillingState,BillingPostalCode
HAVING (count(BillingStreet) > 1  AND count(BillingPostalCode) > 1 )
] )
{
mapAccountBillingAddress .add(aggregate.id, ((String)aggregate.get('str')+(String)aggregate.get('ct')+(String)aggregate.get('stt')+(String)aggregate.get('pc')));
	
   
}



 
Best Answer chosen by RarLopz
@anilbathula@@anilbathula@
Hi RarLopz,

You cant use "add" to put values in Map chnage this line.
 
mapAccountBillingAddress.Put(aggregate.id, ((String)aggregate.get('str')+(String)aggregate.get('ct')+(String)aggregate.get('stt')+(String)aggregate.get('pc')));

Thanks
Anil.B

All Answers

@anilbathula@@anilbathula@
Hi RarLopz,

You cant use "add" to put values in Map chnage this line.
 
mapAccountBillingAddress.Put(aggregate.id, ((String)aggregate.get('str')+(String)aggregate.get('ct')+(String)aggregate.get('stt')+(String)aggregate.get('pc')));

Thanks
Anil.B
This was selected as the best answer
RarLopzRarLopz
@Anil.B my bad !!!! that was a mistake from copying and pasting my previous code.