You need to sign in to do that
Don't have an account?

apex:variable not change with contidion in apex:pageBlockTable
Hi my name is Alejandra,
I try to display in a column an variable that change with condition. The thing is that the variable set the last value, and not iterate with rows of table.
<apex:pageBlockTable value="{!contact.Beneficios__r}" var="beneficio" cellPadding="3" border="1" columnsWidth="50px,110px,60px,60px,230px" rules="all">
<apex:column value="{!beneficio.Name}"/>
<apex:column value="{!beneficio.Catalogo_Beneficio__c}"/>
<apex:column value="{!beneficio.Moneda__c}"/>
if({!beneficio.monto_estimado__c} == null){
<apex:variable var="monto" value="{!beneficio.Monto_Dolares__c}" />
}
else{
<apex:variable var="monto" value="{!beneficio.monto_estimado__c}" />
}
<apex:column value="{!monto}"/>
<apex:column value="{!beneficio.proposito__c}"/>
</apex:pageBlockTable>
Please can tell me what is wrong in mi code?
Regards,
Hi Alejandra,
Try this one.
<apex:pageBlockTable value="{!contact.Beneficios__r}" var="beneficio" cellPadding="3" border="1" columnsWidth="50px,110px,60px,60px,230px" rules="all">
<apex:column value="{!beneficio.Name}"/>
<apex:column value="{!beneficio.Catalogo_Beneficio__c}"/>
<apex:column value="{!beneficio.Moneda__c}"/>
<apex:column value="{!beneficio.Monto_Dolares__c}" rendered="{!IF(beneficio.monto_estimado__c != NULL, FALSE, TRUE)}"/>
<apex:column value="{!beneficio.monto_estimado__c}" rendered="{!IF(beneficio.monto_estimado__c != NULL, TRUE, FALSE)}"/>
<apex:column value="{!beneficio.proposito__c}"/>
</apex:pageBlockTable>
All Answers
Hi Alejandra,
Try this one.
<apex:pageBlockTable value="{!contact.Beneficios__r}" var="beneficio" cellPadding="3" border="1" columnsWidth="50px,110px,60px,60px,230px" rules="all">
<apex:column value="{!beneficio.Name}"/>
<apex:column value="{!beneficio.Catalogo_Beneficio__c}"/>
<apex:column value="{!beneficio.Moneda__c}"/>
<apex:column value="{!beneficio.Monto_Dolares__c}" rendered="{!IF(beneficio.monto_estimado__c != NULL, FALSE, TRUE)}"/>
<apex:column value="{!beneficio.monto_estimado__c}" rendered="{!IF(beneficio.monto_estimado__c != NULL, TRUE, FALSE)}"/>
<apex:column value="{!beneficio.proposito__c}"/>
</apex:pageBlockTable>
Regards,
--
*Alejandra Helguero
*