Saturday, November 3, 2012

Simple variables and Formulas:

Simple variables and Formulas:
This example shows how to use formulas directly from page.

<apex:page sidebar="false">
{! $User.FirstName}<br/>
first name and last name of the logged-in user: {! $User.FirstName} {! $User.LastName}<br/>
{! $User.firstname & ' ' & $User.lastname}<br/>
<p> Today's Date is {! TODAY()} </p>
<p> Next week it will be {! TODAY() + 7} </p>
<p>The year today is {! YEAR(TODAY())}</p>
<p>Tomorrow will be day number {! DAY(TODAY() + 1)}</p>
<p>Let's find a maximum: {! MAX(1,2,3,4,5,6,5,4,3,2,1)} </p>
<p>The square root of 49 is {! SQRT(49)}</p>
<p>Is it true? {! CONTAINS('salesforce.com', 'force.com')}</p>
{! IF ( CONTAINS('salesforce.com','force.com'), 'Yep', 'Nah') }<p/>
{! IF ( DAY(TODAY()) > 14, 'After the 14th', 'On or before the 14th') }<p/>

</apex:page>