function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rakesh KumarRakesh Kumar 

getting extra white spaces when i iterate list of Map on visualforce...

Hi all,

 

Urgent,

 

I am getting problem when i download data in excel file to visualforce.I found the reason why its generating an extra spaces on GUI or excel sheet becuase i am iterating a list of Map on the visualforce.if i remove the map that i am iterating within list then i will work fine.

 

Code sample:

 
 List<String> accList = new List<String>();

 acc = new List<Account>();
           if(accList !=null && accList.size() > 0){
            totalRows = accList.size();
            acc = [SELECT id,Segument_nov__c, LastName,FirstName,City_nov__c FROM Account Where id IN :accList order by Region_Code_nov__c, Hospital_Name_Kana_nov__c,Department_Name_nov__c,DR_Kana_nov__c asc];  
           }
               
          for(Integer l=0;l<acc.size();l++){
           for(Integer i=0; i< cpdList.size();i++){
                if(acc[l].id == cpdList[i].Cycle_Plan_Target_vod__r.Cycle_Plan_Account_vod__c){

                     List<String> x_list = new List<String>();
                     
                     if(cpdList[i].Tier_nov__c != null)
                     x_list.add(cpdList[i].Tier_nov__c);
                     else
                     x_list.add('');
                     
                    ksList = [SELECT id, Actual_nov__c, Planned_nov__c,Action_Status_nov__c,LastModifiedDate,Parent_Key_Message_Report_nov__r.name,Parent_Key_Message_Report_nov__c,Cycle_Plan_Target_Name_nov__r.name FROM Key_Message_Status_nov__c where Parent_Key_Message_Report_nov__c =:keyList AND Cycle_Plan_Target_Name_nov__c =:cpdList[i].Cycle_Plan_Target_vod__c];
                    if(ksList !=null && ksList.size() > 0 ){
                        kMap.put(acc[l].id,ksList);
                        x_list.add(String.valueOf(ksList[0].LastModifiedDate));
                    }else{
                        ksList.add(new Key_Message_Status_nov__c());
                        kMap.put(acc[l].id,ksList);
                        x_list.add('');
                    }
                    
                 
                     if(cpdList[i].Cycle_Plan_Target_vod__c != null)
                     x_list.add(cpdList[i].Cycle_Plan_Target_vod__c);
                     else
                     x_list.add('');
                         
                    if(x_list != null && x_list.size()>0)
                    xMap.put(acc[l].id,x_list);
                    
                    break;
                    
                }
             }
           }

 

Visualforce ::

 

 <apex:repeat value="{!ActionRecords}" var="target">
    <tr height="35px" >
      <td  width="60px">{!target.wAc.City_nov__c}</td>
      <td  width="60px">{!target.wAc.Primary_Parent_vod__r.name}</td>
      <td  width="60px">{!target.wAc.Department_Name_nov__c}</td>
      <td  width="60px">{!target.wAc.LastName} {!target.wAc.FirstName}</td>
      <td  width="60px"></td>


      <td  >{!xMap[target.wAc.id][0]}</td>
      <apex:repeat value="{!KeyMessageList}" var="km">
          <td  align="center"   >
           <apex:repeat value="{!kMap[target.wAc.id]}"  var="kms">
                 {!IF(km.id = kms.Parent_Key_Message_Report_nov__c, IF(!ISNULL(kms.Actual_nov__c),kms.Actual_nov__c,kms.Planned_nov__c),'')}
           </apex:repeat>  
           </td>
      </apex:repeat>
 
     <td style="background-color:#e4ecf7">{!xMap[target.wAc.id][1]}</td>
    </tr>

</apex:repeat>

 

 

Note:: If i remove those bold code from visualforce then white space is not generating.i dont know what should i do for it. is there something wrong in my code?

 

Please help me.

 

Thanks

R.K