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
venkateshyadav1243venkateshyadav1243 

showing the List values in visualforce page

Hi

i write method for geting the distinct values from one filed ,

Am getting the values in debug log

now this values i have to show in vf page how can i show that.

i try with repeat tag but am not getting result can any one help me

 below is my code

 

 

public List<string> getinbound()
    {
                set<String> setValues = new set<String>();
                List<string> lstOptions = new List<string>();
            
                
                for(Samples_Mgmt__c  sm : [Select Inbound_Carrier__c from Samples_Mgmt__c where Digital_Factory__c=:Myid])
                {
                   setValues .add(sm .Inbound_Carrier__c );
                }
                     system.debug('inbound'+setValues );
            
                for(String str : setValues )
                {
                    if(str!=null)
                    {
                    lstOptions.add(str);
                    }
                }
                 system.debug('inboundmyidinbound'+lstOptions);
                 return lstOptions;
          
              
       }

 

 

and here my vf page what am tryibg

 

<apex:repeat value="{!inbound}" var="a">
    
    <tr>
<td><apex:outputText value="{!a.inbound_carrier__c}" /></td>
</tr>
    </apex:repeat></p>

 

 

can any one tel me how can i show values in my vf page

CharlesDouCharlesDou

Hi,

 

I had the same problem weeks ago. What I did to fix it is to call the getInbound() method in a pagereference method. Try something like this:

 

public pageReference yourMethod(){
     List<String> strings = getInbound();
     ....
     ....
}

 And change the code in VF page:

<apex:repeat value="{!strings}" var = "a">

 I am not sure if the method that calls getInbound() must be pagereference or not. Let me know if it works.

CharlesDouCharlesDou

Hey,

 

I just realized that inbound is a list of Strings, so {!a.inbound_carrier__c} in your VF code is not correct. Try to use {!a} instead.

venkateshyadav1243venkateshyadav1243

hi Charles thanks for u r replay i try like this also am getting result in debug log but it is not showing in the vf page

<p><em><strong>Inbound Carrier </strong></em>:
<apex:repeat value="{!inbound}" var="a">
<tr>
<td><apex:outputtext value="{!a}" /></td>
</tr>
    </apex:repeat></p>



can u tel me where am doing mistak.


thanks
venktesh yadav

CharlesDouCharlesDou

Did you make the inbound list as {get;set;}? That might be your problem.