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
Adam RycroftAdam Rycroft 

Visualforce Page - Show formula fields as rendered

Hello,

I'm new to working on Visualforce pages.

We have an object that if a checkbox field is marked as true by the user, there is a formula field that returns a line of text if true, null if false. An example of one of these formulas is:

IF( Household_Budget_does_not_Show_a_Need__c , "Household budget does not show a need for the level of assistance requested", null)

I have it set to treat blank fields as blank.

There are about 21 of these fields. The problem I'm having with the Visualforce page is that when the field is null, it's still leaving a line of space on the pdf. What I would like is if the value is null, there will be no line of space.

Currently on the Visualforce page, I have it set up like:<apex:outputfield value="{!Application_Update__c.Household_Budget_Text__c}"/> 

How can I display this field that if it's null it will not take up a line of space on the Visualforce page?
Sure@DreamSure@Dream
Hi Adam,

Try the below code:
<apex:outputfield value="{!Application_Update__c.Household_Budget_Text__c}" rendered="{!NOT(ISBLANK(Application_Update__c.Household_Budget_Text__c)}"/>

Mark this as the solution, if it solves your problem.

Thanks
Adam RycroftAdam Rycroft
It's still leaving a blank line on the Visualforce pdf. I also tried changing the code to you wrote from ISBLANK to ISNULL and it still didn't work.

Is having the text formula have the false value as null set up correctly?
Adam RycroftAdam Rycroft
I worked around this by adding in an unordered list. However, unless the last option is marked true (information does not match) it adds an extra bullet to the end. Is there a way to prevent this? Here's what the code looks like for this section:

<ul>
<li><b><apex:outputfield value="{!Application_Update__c.No_Proof_of_Diagnosis_Text__c}"/></b></li>
 <li><b><apex:outputfield value="{!Application_Update__c.Proof_of_Diagnosis_in_Unacceptable_Text__c}"/></b></li>
 <li><b><apex:outputfield value="{!Application_Update__c.Household_Budget_Text__c}"/></b></li>
 <li><b><apex:outputfield value="{!Application_Update__c.Expenses_are_unrelated_to_HIV_text__c}"/></b></li>
  <li><b><apex:outputfield value="{!Application_Update__c.No_income_text__c}"/></b></li>
  <li><b><apex:outputfield value="{!Application_Update__c.Income_is_too_high_text__c}"/></b></li>
  <li><b><apex:outputfield value="{!Application_Update__c.Rent_to_income_ratio_too_low_text__c}"/></b></li>
  <li><b><apex:outputfield value="{!Application_Update__c.Rent_to_income_ratio_high_text__c}"/></b></li>
  <li><b><apex:outputfield value="{!Application_Update__c.Rent_FMR_text__c}"/></b></li>
  <li><b><apex:outputfield value="{!Application_Update__c.Already_in_Low_Income_Housing_Text__c}"/></b></li>
  <li><b><apex:outputfield value="{!Application_Update__c.Maximum_amount_already_accessed_text__c}"/></b></li>
  <li><b><apex:outputfield value="{!Application_Update__c.Waiting_Period_text__c}"/></b></li>
  <li><b><apex:outputfield value="{!Application_Update__c.Payee_is_a_property_management_text__c}"/></b></li>
  <li><b><apex:outputfield value="{!Application_Update__c.Name_of_owner_did_not_match_payee_text__c}"/></b></li>
  <li><b><apex:outputfield value="{!Application_Update__c.Could_not_find_property_owner_name_text__c}"/></b></li>
  <li><b><apex:outputfield value="{!Application_Update__c.Forms_appear_to_have_been_altered_text__c}"/></b></li>
  <li><b><apex:outputfield value="{!Application_Update__c.Registered_for_HCM_text__c}"/></b></li>
  <li><b><apex:outputfield value="{!Application_Update__c.Already_living_in_unit_PHP_only_text__c}"/></b></li>
  <li><b><apex:outputfield value="{!Application_Update__c.Returning_security_deposit_text__c}"/></b></li>
  <li><b><apex:outputfield value="{!Application_Update__c.Other_text__c}"/></b></li>
  <li><b><apex:outputfield value="{!Application_Update__c.Information_does_not_match_text__c}"/></b></li>
  </ul>