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
Aravind RAravind R 

How to change apex column value on if condition?

I have an apex column as below

<apex:column value="on {!wrkf.Last_Updated_Date__c} by  {!wrkf.Last_Updated_By__c}" />

But I want to print when     !wrkf.Last_Updated_Date__c != null    otherwise I want tp print nothing. Please help me


eg1..      On 23/01/2014 by John
eg2       (Nothing to be printed)
Best Answer chosen by Aravind R
Tony TannousTony Tannous
Hello,

you have 2 solution :

solution 1 :

utilisation de rendered 

<apex:column headerValue="Update BY">
           <apex:outputText  value="on {!wrkf.Last_Updated_Date__c} by  {!wrkf.Last_Updated_By__c}"  rendered="{!wrkf.Last_Updated_Date__c != null}"/>
</apex:column>

Solution 2:

<apex:column value="{!IF(wrkf.Last_Updated_Date__c != null, "on {!wrkf.Last_Updated_Date__c} by  {!wrkf.Last_Updated_By__c}"", "")}" />

Regards

All Answers

Tony TannousTony Tannous
Hello,

you have 2 solution :

solution 1 :

utilisation de rendered 

<apex:column headerValue="Update BY">
           <apex:outputText  value="on {!wrkf.Last_Updated_Date__c} by  {!wrkf.Last_Updated_By__c}"  rendered="{!wrkf.Last_Updated_Date__c != null}"/>
</apex:column>

Solution 2:

<apex:column value="{!IF(wrkf.Last_Updated_Date__c != null, "on {!wrkf.Last_Updated_Date__c} by  {!wrkf.Last_Updated_By__c}"", "")}" />

Regards
This was selected as the best answer
Aravind RAravind R
Thanks Tony, Its working....