+ Start a Discussion
JimmyMacJimmyMac 

Can a String value be used within <apex:outputText>?

I have the following MAP defined: CarrierMap<Id, String>

 

It contains the following:

1ax123abc,Banner Life

1ax123def,Banner Life

1ax123ghi,Prudential

 

All I want to do in my page is loop thru and when I find a match on i.payout__Carrier__c  versus the Id in my map, I want to display the keyvalue (i.e Banner Life)

 

<td  height="18px" width="5%" style="text-align:left">

                   <apex:repeat value="{!CarrierMap}" var="key" >

                      <apex:repeat value="{!CarrierMap[key]}" var="keyvalue" >

                        

                            <apex:outputText value="{!if(key == i.payout__Carrier__c,keyvalue ,'')}" >

                        

                      </apex:repeat>

                   </apex:repeat>

 </td>  

 

 

The value 'Banner Life' is not a valid number

Error is in expression '{!if(key == i.payout__Carrier__c,keyvalue,'')}' in component <apex:outputText> in page statements

 

It appears that the apex:outputText is ALWAYS expecting a numeric value, can I not use a STRING value to display inside a <apex:outputText> ?

 

Thanks this has been driving me INSANE!

thatheraherethatherahere

No its not like that <apex:outputText>  always expects a numeric value.

as far as i can see there is nothing wrong with your code, but can you tell me what value your variable i.payout__Carrier__c contain?

JimmyMacJimmyMac

Sure, it is an Id type.