1

I'm trying to display the Description (Comments) field on a Task in a Visualforce page, but the field is too long for the column in which I'm displaying it. So, I tried to use the LEFT Visualforce function to get the leftmost 100 characters.

However, I'm receiving this error:

Save error: Syntax Error. Missing ')'

Here's my Visualforce Markup. Activities is of type ActivityHistory.

<apex:pageblocktable value="{!Activities}" var="activity" style="width:100%;">
  <apex:column value="{!activity.OwnerId}" headervalue="Name (Assigned)" />
  <apex:column value="{!activity.WhoId}" headervalue="Contact" />
  <apex:column value="{!LEFT(activity.Description, 100)}" headervalue="Comments" />
  <apex:column value="{!activity.ActivityDate}" headervalue="Date" />
</apex:pageblocktable>

While the above does not work, when I change the <apex:column> to this (below) it does work but it doesn't accomplish what I'd like to.

<apex:column value="{!activity.Description}" headervalue="Comments" />

Why is this error occurring, and how can I fix it?

1 Answer 1

1

Apparently the <apex:column> component does not allow (at least some) Visualforce formulas in its value attribute. I got this to work by using an <apex:outputtext> component inside of the <apex:column>.

<apex:pageblocktable value="{!Activities}" var="activity" style="width:100%;">
  <apex:column value="{!activity.OwnerId}" headervalue="Name (Assigned)" />
  <apex:column value="{!activity.WhoId}" headervalue="Contact" />
  <apex:column headervalue="Comments">
    <apex:outputtext value="{!LEFT(activity.Description, 100)}" />
  </apex:column>
  <apex:column value="{!activity.ActivityDate}" headervalue="Date" />
</apex:pageblocktable>

You must log in to answer this question.

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