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

how can i display a block in if statement
Hello everybody,
Is possible display a blockTable in the if statement. Please tell me how can I do that?
Regards,
You need to sign in to do that
Don't have an account?
Hello everybody,
Is possible display a blockTable in the if statement. Please tell me how can I do that?
Regards,
So talking about if statement in VF they can help you decide what value should be returned when a satement is true. More like a ternary operator.
I don't think you can insert a whole page blocktable inside a IF block. Well I dont even can think of it. I am assuming you are having a complex logic. But I guess rendered will be more than enough to display things.
so lets say.
Then VF will be pretty simple believe me.
Hi There are a lot of solution for it. You can rerender or you can use some style to hide or show block on the basis of required criteriea.
Thanks all for your answers, the thing is that I have the following results
Name Contact
Benefits (Other table)
But, when the contact don't have Benefits, I don't want take the contact, I don't want show the table empty, only with your name.
How can I do that, please help me.
This is the code in my apex class
public List<Contact> getBeneficiosUsd()
{
Contact[] contactos = [SELECT contact.Name, (SELECT Name, Moneda__c, Monto_Dolares__c, proposito__c, Contacto__c, fecha_entrega__c, Catalogo_Beneficio__c FROM contact.Beneficios__r WHERE Moneda__c = :idMonedausd) FROM contact where Sayana__c = :idSayana];
return contactos;
}
And this is my vf page
<apex:pageBlock title="Beneficios Dolares">
<table border="0" >
<apex:repeat var="beneficio" value="{!BeneficiosUsd}">
<tr>
<th style="width: 55px;">Beneficiario:</th>
<td>{!beneficio.Name}</td>
</tr>
<tr>
<td colspan="2">
<apex:pageBlockTable value="{!beneficio.Beneficios__r}" var="c" cellPadding="3" border="1" columnsWidth="50px,110px,60px,60px,230px" rules="all">
<apex:column value="{!c.Name}"/>
<apex:column value="{!c.Catalogo_Beneficio__c}"/>
<apex:column value="{!c.Moneda__c}"/>
<apex:column value="{!c.Monto_Dolares__c}" style="text-align: right;"/>
<apex:column value="{!c.proposito__c}"/>
<apex:column value="{!c.fecha_entrega__c}"/>
</apex:pageBlockTable>
</td>
</tr>
</apex:repeat>
</table>
</apex:pageBlock>