0

I'm getting the error: Syntax error. Found 'IF'

In my controller I have a Map<Id,String> which is working fine. In my page I have the following:

<apex:column value="{!IF((myMap[case.myField__r.Id]!=null),myMap[case.myField__r.Id],'')}" headerValue="My Heading"/>

I have done this, because the Map get might return null. Why am I getting this error?

2 Answers 2

3

I think if the IF returns false your column's value parameter will be blank. That is not allowed so maybe you can change it to this

<apex:column>
     <apex:facet name="header">My Heading</apex:facet>
     <apex:outputText value="{!IF((myMap[case.myField__r.Id]!=null),myMap[case.myField__r.Id],'')}" />
</apex:column>
0

You can also use headerValue attribute instead of column's header facet as below.

<apex:column headerValue="My Heading">
    <apex:outputText value="{!IF((myMap[case.myField__r.Id]!=null),myMap[case.myField__r.Id],'')}"/>
</apex:column>

You must log in to answer this question.

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