I have a query that returns a list of accounts that are close to my "current" Account and I display them in a visualforce page in the form of a googlemap. Here is the query:

warehouses =  [
                           SELECT Id,LocateCity__c,ShippingPostalCode,ShippingState, ShippingCity,Auftragseingang_SM_letzte_24_Monate__c, Name,URL_zum_CC__c,Mitarbeiternzahl_final__c,Auftragseingangstyp__c,AD_MS_Rel_Anzahl_bez__c,Vollst_ndiger_Name__c,ShippingStreet,LocateCity__longitude__s, LocateCity__latitude__s, OwnerId,GeoLocPosition__c,Accountinhaber_Text__c,WirtschaftszweigWZ08__c,WZ_Code_ebene_2__c,AE_letzte_12_Monate__c ,anzeigendaten_de_ID_account__c,indexurl__c
                           FROM Account 
                           WHERE Letzte_gew_Opp_OneSales_in_Tagen__c <= :myTime AND DISTANCE(LocateCity__c, GEOLOCATION(:dlat,:dlon), 'km') < :decimal.valueof(myInput) AND Id != :theaccId 
                  //       ORDER BY DISTANCE(LocateCity__c, GEOLOCATION(:dlat,:dlon), 'km')          
                           LIMIT :recordLimit

However I am having some trouble with ORDER BY. Right now I am not using ORDER BY since it is the reason that not all markers are getting displayed:

here the result with ORDER BY:

enter image description here

here the result without ORDER BY:

enter image description here

In both cases we talk about 292 records, so the query is fine. It is just about displaying the right amount of mapmarkers. While doing some research I have read it might have sth to do with the fact, that the map gets "re-rendered" before the ORDER BY is done?!

In the end I would like to have the possibility to display the records in an order.

Thanks in advance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.