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
dhcrusoedhcrusoe 

Simple APEX IF Statement - What's wrong with this?

Hey there,

 

I'm trying to display a print button IF there is certain information in the URL string, e.g., an ?id= field. Here's my statement:

 

 

rendered="{!IF({!id} != 'null', true, false)}

 

 Clearly, it didn't like this... any suggestions to fix? Thanks!

 

--Dave

 

p.s. here's the entire element:

 

 

<apex:outputLink rendered="{!IF(id != 'null', true, false)}" target="_blank" value="/apex/CTN_Lessons_37p?apprenticeshipId={!apprenticeshipID}&ctContactId={!ctContactId}&id={!id}">Print My Lesson</apex:outputLink>

 

 

 

 

dhcrusoedhcrusoe

p.s. also trying...

 

{!IF({!$CurrentPage.parameters.id}

 e.g.,

 

 

rendered="{!IF(($CurrentPage.Parameters.id != 'null'), false, true)}"

 

 

 

 

neither of which which seem to work...

 

 

Message Edited by dhcrusoe on 06-01-2009 09:12 AM
dhcrusoedhcrusoe

All,

 

This seems to work -- any way to improve it? 

 

<apex:outputLink rendered="{!IF(($CurrentPage.parameters.id != ''), true, false)}" target="_blank" value="/apex/CTN_Lessons_37p?apprenticeshipId={!apprenticeshipID}&ctContactId={!ctContactId}&id={!id}">Print My Lesson</apex:outputLink>

 

 

 

ahab1372ahab1372
does ISNULL work?
lukaz1010lukaz1010

I'd try ternary operator:

rendered="{! ({!id} != 'null') ? true : false }"

 



craigmhcraigmh
rendered="{!(id != null)}"

 

Just use the comparison.