You need to sign in to do that
Don't have an account?
jill.longo
Help with Visualforce IF statement
I need to create a table that contains only contact records where a custome field called Escalation Contact is checked. The table should contain the Name of the contact and phone number. I'm having trouble with my IF statement and don't know if i have it placed in the correct location.
<apex:page standardController="Account">
<apex:pageBlock >
<apex:pageBlockTable value="{! account.contacts}" var="item">
<apex:column value=" {IF({!item.Escalation_Contact__c},"{!item.name}", "")}"/>
<apex column value="{! item.phone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
<apex:page standardController="Account">
<apex:pageBlock >
<apex:pageBlockTable value="{! account.contacts}" var="item">
<apex:column value=" {IF({!item.Escalation_Contact__c},"{!item.name}", "")}"/>
<apex column value="{! item.phone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
All Answers
If this helps,please mark it as best answer to help others :)
http://www.infallibletechie.com/2013/02/how-to-fetch-data-from-controller-and_6.html
Please mark this as the best answer if this resolved your requirement.
Ramu_SFDC is correct - to filter the data that appears in a list, you will need to query that data from an APEX controller. Were you able to figure this out or do you need further assistance?
Change your code from
public getlstContacts() {
return [SELECT Id, Name, Phone FROM Contact
WHERE AccountId = :scMain.getId()
AND Escalation_Contact__c = true
ORDER BY Name ASC LIMIT 1000];
}
to
public List<Contact> getlstContacts() {
return [SELECT Id, Name, Phone FROM Contact
WHERE AccountId = :scMain.getId()
AND Escalation_Contact__c = true
ORDER BY Name ASC LIMIT 1000];
}
(back in town)
Can you post your full code back on here?