You need to sign in to do that
Don't have an account?

How to limit the # of characers displayed in an outputField?
I have a requirement to limit the # of characters displayed in an outputfield. If the field value is > 100 characters, the displayed text should be truncated. As shown below, I tried to use 'left' to limit the characters to 100, but I recieve the following error:
Can I accomplish this in VF without using a controller?
<apex:outputField value="{left(!cx.match_criteria__r.searcher__r.account.Investment_Focus__c,100)}" />
so this is what i tried and it's working
<apex:page standardController="account"> <apex:outputText value="{!LEFT(account.name,12)}"></apex:outputText> </apex:page>
All Answers
i think you can, change the {! location like this:
<apex:outputField value="{!left(cx.match_criteria__r.searcher__r.account.Investment_Focus__c,100)}" />
Thanks Ron!
I am recieving the following syntax error, but only when using the code you provided:
Error: Syntax error. Missing ')'
What do you make of this?
Thanks,
B.T.
so this is what i tried and it's working
<apex:page standardController="account"> <apex:outputText value="{!LEFT(account.name,12)}"></apex:outputText> </apex:page>
Thanks Ron!
I don't understand why it should make a difference...but when I changed from <apex:outputField> to <apex:outputText> I no longer recieved the error.
Can you help me (us) understand why?
output field is a much more complex tag, it will bind it's value to a very specific field of an sobject.
output text is simpler, and will bind to the output of an expression or field value.
It is worth noting that the message: "value for outputField is not a dynamic binding!" can occur:
<apex:outputField value="{left(!cx.match_criteria__r.searcher__r.account.Investment_Focus__c,100)}" />
<apex:outputField value="{left(!cx.match_criteria__r.searcher__r.account.Investment_Focus__c,100)"
value for outputField is not a dynamic binding!
Possible reason: missing {! ............. } braces for the expression.
<apex:pageblocktable id="table1" value="{!lstMyLiveIOs}" var="obj" >
<apex:column headerValue="Booked Quantity">
<apex:outputField value="obj.FB_Quantity__c" />
</apex:column>
</apex:pageblocktable>
Correct syntax is:
<apex:outputField value="{!obj.FB_Quantity__c}" />