You need to sign in to do that
Don't have an account?
Charles McDowell
I have the following code to create a map that is returned to a class. I can not retrieve the values
public class RetrievePrice {
Public Static Map<String , Double> UtilPrice(){
List<Utility_Price__c> upp =[Select Price_Type__c, Price__c From Utility_Price__c ];
Map<String, Double> pMap = new Map<String, Double>();
{
for (Utility_Price__c p :upp){
pmap.put(p.price_type__c, p.Price__c);
system.debug('The price is:' + p.Price__c);
}
Return pmap;
}
}
}
public class createInvoice{
static Map<String, Double> Price = new Map<String, Double>();
createInvoice(){
Price = RetrievePrice.UtilPrice();
}
}
How do I reference the values in the map
Public Static Map<String , Double> UtilPrice(){
List<Utility_Price__c> upp =[Select Price_Type__c, Price__c From Utility_Price__c ];
Map<String, Double> pMap = new Map<String, Double>();
{
for (Utility_Price__c p :upp){
pmap.put(p.price_type__c, p.Price__c);
system.debug('The price is:' + p.Price__c);
}
Return pmap;
}
}
}
public class createInvoice{
static Map<String, Double> Price = new Map<String, Double>();
createInvoice(){
Price = RetrievePrice.UtilPrice();
}
}
How do I reference the values in the map
make your class constructor public thanks
let me inform if it helps you