You need to sign in to do that
Don't have an account?
etechcareers
List Out Of Bounds:0..????
Hi:
If a SOQL Query has no records I keep getting List Out Of Bounds:0..
How can I write a message stating to the user " There are no records for the filters selected" onto my VF Page???
Thanks
eTechCareers
Do this
In your controller
Define a boolean variable
public Boolean renderError{get;set}
Then, after you get the List
if (List.size() > 0){
renderError = false;
}else{
renderError = true;
}
Then in your page
<apex:outputPanel rendered="{!renderError}" layout="none">
There are no records for the filters selected
</apex:outputPanel>
Also put the code in your page where the list is showed into an output panel
<apex:outputPanel rendered={!!renderError}" layout="none>
your code here
</apex:outputPanel>
I hope it helps
Ignacio
All Answers
Do this
In your controller
Define a boolean variable
public Boolean renderError{get;set}
Then, after you get the List
if (List.size() > 0){
renderError = false;
}else{
renderError = true;
}
Then in your page
<apex:outputPanel rendered="{!renderError}" layout="none">
There are no records for the filters selected
</apex:outputPanel>
Also put the code in your page where the list is showed into an output panel
<apex:outputPanel rendered={!!renderError}" layout="none>
your code here
</apex:outputPanel>
I hope it helps
Ignacio
it will be better to use .isEmpty();