• Harpreet Kaur 45
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 10
    Replies
global with sharing class LeadsNearbyMe {
          public static List<Lead> result;
@RemoteAction
   global static List<Lead> getNearby(String lat, String lon) {
    
     Location loc1 = Location.newInstance(Decimal.Valueof(lat),Decimal.Valueof(lon));
      
     result=[SELECT Id, Name, Longitude, Latitude, Street, City,State,Country, PostalCode FROM Lead WHERE DISTANCE(Address,:loc1, 'km') < 60 ORDER BY DISTANCE(Address, :loc1, 'km') LIMIT 10];
   
       return result;
    }

}
I would like to know how can we create visualforce craeted automatically for record saved using apex controller.
for example , List<Class__c> c = [Select CurrentRates__c,.... from Class__c];
                      List<List<Class__c>> abc = new List<List<Class__c>>();
                      abc.add(c);  // Suppose we added 3 Classes. Could be more
So, Based on CurrentRates field I want to compare all the classes in abc and and if CurrentRates field value is different then, I want to add all other fields. This what i have in my List of Objects. I ant to comapre for example Life current rates and combine them. if same only display onceand if different then display both in rows and add the values.
Please help
User-added image
global with sharing class LeadsNearbyMe {
          public static List<Lead> result;
@RemoteAction
   global static List<Lead> getNearby(String lat, String lon) {
    
     Location loc1 = Location.newInstance(Decimal.Valueof(lat),Decimal.Valueof(lon));
      
     result=[SELECT Id, Name, Longitude, Latitude, Street, City,State,Country, PostalCode FROM Lead WHERE DISTANCE(Address,:loc1, 'km') < 60 ORDER BY DISTANCE(Address, :loc1, 'km') LIMIT 10];
   
       return result;
    }

}
for example , List<Class__c> c = [Select CurrentRates__c,.... from Class__c];
                      List<List<Class__c>> abc = new List<List<Class__c>>();
                      abc.add(c);  // Suppose we added 3 Classes. Could be more
So, Based on CurrentRates field I want to compare all the classes in abc and and if CurrentRates field value is different then, I want to add all other fields. This what i have in my List of Objects. I ant to comapre for example Life current rates and combine them. if same only display onceand if different then display both in rows and add the values.
Please help
User-added image