0

Is it possible to render column values based on condition in a visualforce page? I tried

<apex:outputText rendered="{!b.account.name == !a.account.name}">
    <apex:column value="{!b.name}"/>      
</apex:outputText>

Error:

Incorrect parameter type for function 'not()'. Expected Boolean, received Text

2 Answers 2

1

An <apex:column> component must always be a child of an <apex:dataTable> or <apex:pageBlockTable> component.

But you can do like this.

<apex:pageblockTable value="{!cont}" var="b">
<apex:column value="{!b.name}" rendered="{!IF(b.account.name == a.account.name,true,false)}"/>
 </apex:pageBlockTable>

refrence <apex:column>

1
  • Your welcome ...
    – NITHESH K
    Commented Aug 31, 2017 at 8:05
0

This is due to !a.account.name. You don't need to precise a second '!' character.

Here's the right way to use a conditional expression in visualforce:

rendered="{!IF(b.account.name = a.account.name,true,false)}"
4
  • An <apex:column> component must always be a child of an <apex:dataTable> or <apex:pageBlockTable> component. can't be surround by <apex:outputText > right?
    – NITHESH K
    Commented Aug 31, 2017 at 7:39
  • @NITHESHK Indeed this is not working? ' <apex:pageblockTable value="{!cont}" var="b"> <apex:outputText rendered="{!IF(b.account.name = a.account.name,true,false)}"> <apex:column value="{!b.name}"/> </apex:outputText> </apex:pageBlockTable> '
    – Jenssen
    Commented Aug 31, 2017 at 7:42
  • @jenssen Yes Exactly
    – NITHESH K
    Commented Aug 31, 2017 at 7:50
  • @Jenssen i have added answer , rendered directly you can use in <apex:column>
    – NITHESH K
    Commented Aug 31, 2017 at 8:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .