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

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>

| improve this answer | |
  • Your welcome ... – NITHESH K Aug 31 '17 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)}"
| improve this answer | |
  • 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 Aug 31 '17 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 Aug 31 '17 at 7:42
  • @jenssen Yes Exactly – NITHESH K Aug 31 '17 at 7:50
  • @Jenssen i have added answer , rendered directly you can use in <apex:column> – NITHESH K Aug 31 '17 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.