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
Ralph PenceRalph Pence 

Using IF statements in VisualForce emails

I'm trying display a field and line break only if a certain checkbox, ".Activity_Completed__c",  is unchecked, otherwise I don't want it to display anything.

<apex:outputText rendered="{!IF(OR(ISBLANK, 'cx.Activity'), !NOT(cx.Activity_Completed__c)), NULL, '{!cx.Activity__c}<br/>'}" />
<apex:outputText rendered="{!IF(OR(ISBLANK, 'cx.Activity1'), !NOT(cx.Activity_Completed1__c)), NULL, '{!cx.Activity__c}<br/>'}" />
<apex:outputText rendered="{!IF(OR(ISBLANK, 'cx.Activity2'), !NOT(cx.Activity_Completed2__c)), NULL, '{!cx.Activity__c}<br/>'}" />
<apex:outputText rendered="{!IF(OR(ISBLANK, 'cx.Activity3'), !NOT(cx.Activity_Completed3__c)), NULL, '{!cx.Activity__c}<br/>'}" />

I'm very new to visualforce so I'm not sure if I'm going in the right direction
Hi Ralph,
Your condition is not clear .

You can try like below .
<apex:ouputPanel rendered="{!If(ISBLANK(cx.Activity)),true,false)}">
		<apex:outputText Value="{!cx.Activity__c}" /><br/>

Add condition in output panel and if condition will satisfy then the component inside will execute and it will give like break after the component .

Try to add your condition accordingly .

Let me know if it helps.

Ken KoellnerKen Koellner
I would make your life easy and write some smart getters in your controller.

Boolean getEnableFeature1 () {
  return String.isBlank(cx.Activity_Completed__c)
               && String.isNotBlank(cx.Activity_Completed1__c);

Then just code rendered="{!enableFeature1}"

Note: I can't make heads or tails of you logic so the above is just an example.  You have to write the logic. But your boolean logic will be much clearer in Apex then in those expressions in VF.  I try to use few if any merge functions in VF merge references.  It's cleaner and easier to write and read in Apex