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
SF OperatorSF Operator 

Show more than 1 record

I want to know how can I show more than 1 record of my list without getting an error.
This is my actual code:
Class:
this.AccountList = [Select  Owner.name
                                From Account
            this.target = this.AccountList.get(0);
Page:
<apex:pageBlockSection title="" collapsible="false" columns="2" rendered="{!target.Name != ''}">
<apex:outputText value="{!target.Name}"/> 
</apex:pageBlockSection>
Best Answer chosen by SF Operator
Agustin BAgustin B
Hi try this (it may contain errors but thats the idea):
Page:
<apex:pageBlockSection title="" collapsible="false" columns="2">
<apex:pageBlockTable value="{!target}" var="a">
<apex:column value="{!a.Name}"/>
</apex:pageBlockTable></apex:pageBlockSection>

Class:
this.target = [Select  Owner.name
                                From Account Where Name != ''];//With target being a List<Account>

If it helps please mark as correct so it can help others.

All Answers

Agustin BAgustin B
Hi try this (it may contain errors but thats the idea):
Page:
<apex:pageBlockSection title="" collapsible="false" columns="2">
<apex:pageBlockTable value="{!target}" var="a">
<apex:column value="{!a.Name}"/>
</apex:pageBlockTable></apex:pageBlockSection>

Class:
this.target = [Select  Owner.name
                                From Account Where Name != ''];//With target being a List<Account>

If it helps please mark as correct so it can help others.
This was selected as the best answer
Agustin BAgustin B
Hi SF operator, please mark my comment above as best so this question can get solved and can help others asking the same.
Good luck!
SF OperatorSF Operator
Thank you a lot, It worked just I needed.