+ Start a Discussion
waylonatcimwaylonatcim 

Error: Syntax error. Missing ')'

I am getting this error when using the following code:

 

<td><apex:outputField value="{!IF(contains(uses.Name,"Signage"),"N/A",uses.Gross_SF__c)}" /></td>

 

 Basically, I have an object (property uses) that I repeat through to build a table of data based on the different uses of a property.  If the current property use in my table is "Signage", I want to display "N/A" else I want to display the Integer value. 

 

There is a related post http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=1071 that suggests this is a bug and a bug fix has been requested. 

 

I am hoping that either I am doing something incorrectly and someone can point it out to me, or that someone might be able to come up with a better solution to this issue. 

 

Best Answer chosen by Admin (Salesforce Developers) 
jwetzlerjwetzler

So the error message is bad, but it doesn't seem to like the fact that you are potentially replacing the value of outputField with a literal string.  outputField doesn't work with literal strings, only sobject fields.

 

I think if you use outputText it will work.

 

If you must have the functionality of outputField, I would use outputText displaying N/A and outputField displaying the field value, and conditionally render them.

All Answers

jwetzlerjwetzler
Try using single quotes around Signage and N/A, I think you're confusing the compiler.
waylonatcimwaylonatcim
It's actually the same result.  I had single quotes originally, but the example in the developer guide shows double quotes.
jwetzlerjwetzler

So the error message is bad, but it doesn't seem to like the fact that you are potentially replacing the value of outputField with a literal string.  outputField doesn't work with literal strings, only sobject fields.

 

I think if you use outputText it will work.

 

If you must have the functionality of outputField, I would use outputText displaying N/A and outputField displaying the field value, and conditionally render them.

This was selected as the best answer
waylonatcimwaylonatcim

That was it!  Using outputText did the trick. 

Thanks for the help!

waylonatcimwaylonatcim

So unfortunately, while the switch to outputText worked, I do need the functionality provided by outptuField (my users complain about the lack of commas in large numbers).  I tried to use the apex tags as output from the IF statement, but I receive the error: Error: Syntax error. Found '<'.  Wrapping the apex tags in quotes won't work because the code just gets displayed.  Just thought I'd mention that if anyone else was running into this issue. 

 

 

 

On a side, I tried using the IF statement in an outputField that had sObjects as both possible outputs and I was given the same error mentioned in the subject line of this thread. 

TehNrdTehNrd

You could do something like this, what Jill recommended above.

<td>
<apex:outputText value="N/A" rendered="{!CONTAINS(uses.Name,"Signage")}"/>
<apex:outputField value="{!uses.Gross_SF__c}" rendered="{!NOT(CONTAINS(uses.Name,"Signage"))}"/>
</td>

- Jason

Message Edited by TehNrd on 07-31-2009 10:37 AM
waylonatcimwaylonatcim

Aha!  Going back and reading Jill's post I think that's what she meant but i read it a different way.

 

Thanks for the help!

Ashish_ShelarAshish_Shelar
@ TehNrd , thanks a lot !!! Your suggestion worked for me .

Arif Iqbal 5Arif Iqbal 5
Hi Team,

I have a formula and seems bizzare as it is working in other places but not for mailing address. I get the following Error: 

Error: Syntax error. Missing ')'

Formula:
IF( 
Disable_Sharing_Main_Contact_Address__c = TRUE, NULL, 

"Mailing Street: " (MailingAddress)

)