You need to sign in to do that
Don't have an account?

Expecting { but was 'for'
Hi,
I am trying to write a class that will find the driving distance to a lookup on the account. I am recieving this error:
Expecting '{' but was: 'for'
Here is the class:
I am trying to write a class that will find the driving distance to a lookup on the account. I am recieving this error:
Expecting '{' but was: 'for'
Here is the class:
public class DrivingDistance1 { geopointe.API.DistanceService ds = new geopointe.API.DistanceService(); List<Account> accList = [SELECT id, distance__c, UCO_Service_Provider__r.Geopointe_Geocode__r.geopointe__Latitude__c, UCO_Service_Provider__r.Geopointe_Geocode__r.geopointe__Longitude__c, geopointe__Geocode__r.geopointe__Latitude__c, geopointe__Geocode__r.geopointe__Longitude__c FROM Account LIMIT 1]; List<Account> origins = new List<Account>(); List<Account> destinations = new List<Account>(); for(Integer i = 0; i < accList.size(); i++){ if(Math.mod(i,2) == 0) { origins.add(accList.get(i)); } else { destinations.add(accList.get(i)); } } for(Integer i = 0; i < origins.size(); i++){ ds.add((Double)origins.get(i).geopointe__Geocode__r.geopointe__Latitude__c, (Double)origins.get(i).geopointe__Geocode__r.geopointe__Longitude__c, (Double)destinations.get(i).UCO_Service_Provider__r.geopointe__Geocode__r.geopointe__Latitude__c, (Double)destinations.get(i).UCO_Service_Provider__r.geopointe__Geocode__r.geopointe__Longitude__c); } for(Integer i = 0; i < origins.size(); i++){ Double distance = ds.getDistanceAtIndex(i); origins.get(i).distance__c = distance; destinations.get(i).distance__c = distance; } update accList; }
All Answers