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
1111_forcecom1111_forcecom 

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,

Best Answer chosen by Admin (Salesforce Developers) 
Arun MKArun MK

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

Arun MKArun MK

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>

This was selected as the best answer
1111_forcecom1111_forcecom
Thank you so much, for the answer; it works.

Regards,

--
*Alejandra Helguero
*