function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
KeithJKeithJ 

CASE embedded in apex outputfield value attribute

Hi.

Anyone know if you can do this? I am trying and it's giving me an error stating 

Error: Syntax error. Missing ')'

 Here is my outputField

 

 

value="{!CASE(currentOppLineItem.usdLineItem.Quote_Currency__c, '(NOK)', currentOppLineItem.nokLineItem.UnitPrice, '(EUR)', currentOppLineItem.eurLineItem.UnitPrice, currentOppLineItem.usdLineItem.UnitPrice)}"

 I have a sneaking suspicion this is not allowed...

Thanks

 

 


 

Ron HessRon Hess
try it all on one line ?
KeithJKeithJ

Thanks for the reply.

I tried this in fact - it's just that when I pasted into the code section in the forums, it wraps to 2 lines...

Strange.

Ron HessRon Hess

does it work if you use outputText ?

 

 

KeithJKeithJ

Unfortunately OutputText wasn't an option as I couldn't afford to loose the formatting.

I tried embedding a MessageFormat string in the outputText value attribute and I got a server error.

I see that messageFormatting has been included since api 10 but it has only been documented this api release.

It's handy to have though!

 

Regardless, I had to change my code around so the need for an embedded case formula was redundant...

 

Thanks for the help though,

Best regards

 

Ron HessRon Hess

i think i see, you are trying to use outputField because it does formating, but you want to decide what field to specify using logic in Visualforce.

 

you may be forced to move the logic into the controller, presenting the VF page with just one field.

 

i tried CASE with outputText and it saved fine.

KeithJKeithJ

Cool! It's good to know that it works for outputText.

I would like to play around with the messaging format capabilities with outputText and see what I can come up with.

To cut a long story short, I got my org multi currency enabled and I was able to get around the problem of trying

to have one of the fields on a opportunityLineItem in a different currency to that of the opportunity that the opplineItem was associated.

 

Tricky but good fun to do! 

Regards