You need to sign in to do that
Don't have an account?
Select next Birthdays
Hi everybody,
first of all: Does anybody know where to get an introduction or better a full documentation of the SOQL database language?
Because not all SQL commands are supported an I want mor about this.
I want to list next contacts birthdays from the logged in user. Display them in an apex page.
Here is the code of my apex page:
<apex:page title="Geburtstage" standardController="Contact" extensions="ContactsNextBirthdays"> <apex:pageBlock title="Next Birthdays of your contacts"> <apex:dataTable value="{!NextBirthdayContacts}" var="contact" styleClass="list"> <apex:column > <apex:facet name="header">Birthdate</apex:facet> <apex:outputText value="{0,date,dd.MM.yyyy}"> <apex:param value="{!contact.Birthdate}" /> </apex:outputText> </apex:column> <apex:column > <apex:facet name="header">Name</apex:facet> <apex:outputText value="{!contact.Name}" /> </apex:column> <apex:column > <apex:facet name="header">Firstname</apex:facet> <apex:outputText value="{!contact.FirstName}" /> </apex:column> <apex:column > <apex:facet name="header">Company</apex:facet> <apex:outputText value="{!contact.account.name}" /> </apex:column> </apex:dataTable> </apex:pageBlock> </apex:page>
And the class code:
public class ContactsNextBirthdays { private final Contact contactObj; public ContactsNextBirthdays(ApexPages.StandardController controller) { this.contactObj = (Contact)controller.getSubject(); } public Contact[] getNextBirthdayContacts() { String UserId = UserInfo.getUserId(); // UserId des eingeloggten Users holen Date Now = System.now().date(); Contact[] contactList = [SELECT Id, Name, FirstName, Birthdate, Account.Name FROM Contact WHERE Birthdate > :Now AND OwnerId = :UserId ORDER BY Birthdate]; return contactList; } }
I tried a lot of queries, but I received never the result I want :-(
Any ideas, help or links for me?
Thanks very much
j.
There's a detailed section on SOQL in the api docs.
http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content/sforce_api_calls_soql.htm