+ Start a Discussion
Robert RobinsonRobert Robinson 

Multiple Map Markers - The sequel

Earlier this year I asked about placing multiple markers on a Google map. The resulting map earned raves. Now the next step is providing different colored markers based on different criteria. The test group is 4 colors I know that I will need to use If-else logic something like
If (portfoilio1 = value 1), marker 1
else if (portfoilio2 = value 2), marker 2
else if (portfoilio3 = value 3), marker 3
else (portfoilio4 = value 4), marker 4
Hovever, I am not placing the statement correctly, as I am seeing errors like "If statement cannot be used inside <apex:map> in the markup". I am wordering if the If-else statement needs to be placed outside of the <apex:map> section.
The Visualforce page (that works for 1 color) is shown below (stanza that identifies the markers in bold):

<apex:page sidebar="false" showHeader="false" standardController="Market__c" extensions="MSAProperty" >
   <!-- This page must be accessed with an Market Id in the URL. For example:  
       https://cs41.salesforce.com/apex/rrmultipropmap?id=a1255000002hr4G -->
  <apex:pageBlock >
    <apex:pageBlockSection Title="Properties in {!Market__c.Name} MSA {!Market__c.MSA_Code__c}">  
  <!-- Section for MSA list -->     
      <apex:pageBlockTable value="{!mprops}" var="mp">
       <apex:column headerValue="Property Name">
              <apex:outputLink value="/{!mp['Id']}" title="{!mp['Name']}" target="_top">{!mp['Name']}</apex:outputLink>
       </apex:column>   
       <apex:column value="{!mp['Portfolio__c']}"/>
       <apex:column value="{!mp['Address__c']}"/>
       <apex:column value="{!mp['City__c']}"/>
       <apex:column value="{!mp['State__c']}"/>
       <apex:column value="{!mp['Zip__c']}"/>
      </apex:pageBlockTable>
 <!-- Section for map features -->
   <apex:map width="600px" height="400px" mapType="hybrid"
    center="{!Market__c.City__c},{!Market__c.State__c}">
     <!-- Add markers for Properties within MSA -->    
     <apex:repeat value="{!mprops}" var="mp">
      <apex:mapMarker title="{! mp.Name }"
       position="{'latitude':{!mp.Geolocation__Latitude__s},'longitude':{!mp.Geolocation__Longitude__s}}"
       icon="{!URLFOR($Resource.HCNMarker4) }">

 
      <!-- Add info window with Property details -->    
      <apex:mapInfoWindow >
            <apex:outputPanel layout="block" style="font-weight: bold;">
              <apex:outputText >{! mp.Name }</apex:outputText>
            </apex:outputPanel>
            <apex:outputPanel layout="block">
              <apex:outputText >{! mp.Portfolio__c }</apex:outputText>
            </apex:outputPanel>   
             <apex:outputPanel layout="block">
              <apex:outputText >{! mp.Address__c }</apex:outputText>
            </apex:outputPanel>               
            <apex:outputPanel layout="block">
              <apex:outputText >{! mp.City__c }, {! mp.State__c }</apex:outputText>
            </apex:outputPanel>               
          </apex:mapInfoWindow>
          
        </apex:mapMarker>
     </apex:repeat>
    </apex:map>
   </apex:pageBlockSection>
  </apex:pageBlock>
</apex:page>


I am likely missing something basic; if someone could point out what, I would be grateful. Thanks.
Robert Robinson 17Robert Robinson 17
Issue resolved with Apex changes