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
Brian Sherman 22Brian Sherman 22 

Conditional text translation in VisualForce Component

We have the following  VF component that lists out unit availability for our company.  It returns results and switches out English text for French text in our autoresponse:

<apex:repeat value="{!lstRentals}" var="item">
<tr>
<td style="text-align:left;padding:5px;"> {!CASE(item.strSiteType,"Bachelor","1 1/2","Junior 1 Bedroom","2 1/2","1 Bedroom","3 1/2","2 Bedroom","4 1/2","3 Bedroom","5 1/2","4 Bedroom","6 1/2","Parking","stationnement","unknown")}</td> <td style="text-align:left;padding:5px;"> {!item.strRent} </td>
<td style="text-align:left;padding:5px;"> {!if(item.strAvailableDate='immediate','immédiatement',item.strAvailableDate)}</td>
</tr>
</apex:repeat>

This is working great, but I need to do the same in a slightly different component.  Currently that component does not translate, and looks like this:

<td style="text-align:left;padding:5px;"> {!n.result['Suite_Type__c']} </td>

I tried the version below without success, not surprisingly as I am a novice at this.

{!CASE(!n.result['Suite_Type__c'],"Bachelor","1 1/2","Junior 1 Bedroom","2 1/2","1 Bedroom","3 1/2","2 Bedroom","4 1/2","3 Bedroom","5 1/2","4 Bedroom","6 1/2","Parking","stationnement","unknown")}

Any ideas on how to map the {!n.result['Suite_Type__c']} so the text is modified as above?
Best Answer chosen by Brian Sherman 22
R Z KhanR Z Khan
oh i think i found it remove ! before n.result in
{!CASE(!n.result['Suite_Type__c']

All Answers

R Z KhanR Z Khan
Hi Brian,

are you receiving any error messages? whats your n variable?
Brian Sherman 22Brian Sherman 22

When I try to trigger the email template that callse this component, I get an error:

Error occurred trying to load the template for sending preview email: Incorrect parameter type for function 'NOT()'. Expected Boolean, received Text. Please try editing your markup to correct the problem.

My n variable:

<apex:repeat value="{!site}" var="n">

 

R Z KhanR Z Khan
are you using NOT() somewhere? also is "site" a lsit of records?
Brian Sherman 22Brian Sherman 22
There is no NOT() in the component.  "Site" is a list of records.  
R Z KhanR Z Khan
oh i think i found it remove ! before n.result in
{!CASE(!n.result['Suite_Type__c']
This was selected as the best answer
Brian Sherman 22Brian Sherman 22
Thanks!!