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
Victor EcheverríaVictor Echeverría 

Error with <apex:variable> inside a !CASE statement

<apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line">
{!CASE(line.PricebookEntry.Name,
"Comision Adgorithms",<apex:variable value="{!line.TotalPrice}" var="comiadgo"/>

,"")}

</apex:repeat>
I have  the above piece of code but it give me the following error: 
Error: Syntax error. Found '<'

Is there anything wrong with my syntax or am I doing something that salesforce doesn't allow?
Nayana KNayana K
<apex:variable> inside a !CASE statement is not allowed in salesforce
VineetKumarVineetKumar
Use something like this :
<apex:variable value="{!line.TotalPrice}" var="comiadgo"/>
<apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line">
	{!CASE(line.PricebookEntry.Name, "Comision Adgorithms", comiadgo ,"")}
</apex:repeat>
Victor EcheverríaVictor Echeverría
Hey Vineet,

The above code doesn't work for what I'm trying to do. The idea is that with a repeat I go through every opportunity line item searching for specific product names and when I find one I want to save some of its information either its quantity or price in a variable for future use. Is there any other method for using variables? 
VineetKumarVineetKumar
Ohhk that ways, try the below code :
<apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line">
	<apex:variable value="{!line.TotalPrice}" var="comiadgo" rendered="{!IF(line.PricebookEntry.Name, 'Comision Adgorithms', true, false)}"/>
</apex:repeat>