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
Pranav_VaidyaPranav_Vaidya 

Read LIST (array) values on VF page

Below is a method from my controller class. This method is expected to return a LIST with 3 elements. How can I use these 3 elements on my VF page. I don't want to use <apex:repeat>. I want to use all 3 elements in different page blocks on my VF page.

 

Thanks in advance.

 

public List <double> getYTDBudget(){
  AggregateResult[] YTDBud = [Select sum(Budget_Allotted_Month__c)YTDAllot, sum(Budget_Forecast_Month__c)YTDForecast, 
                               sum(Budget_Actual_Month__c)YTDAct
                               from TravelBudgetDetail__c where Travel_budget__r.Id  = 'BD0000cR5a'];  

  List <double> YTDBg=new double[3];

  YTDBg.Set(0, (double) YTDBud[0].get('YTDAllot'));
  
  if ((double) YTDBud[0].get('YTDForecast') == 0 ){
    YTDBg.Set(1,0);
  }
  else{
    YTDBg.Set(1,(double) YTDBud[0].get('YTDForecast'));
  }
  
  YTDBg.Set(2,(double) YTDBud[0].get('YTDAct')); 

  return YTDBg;

 }

 


 

Best Answer chosen by Admin (Salesforce Developers) 
aballardaballard

You should be able to just references them as YTDBudget[0],  YTDBudget[1] and YTDBudget[2].  

 

Though personally I'd use named properties for them instead of a list containing all three.