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

Unable to conditionally render Visualforce Page (Output Panel)
Hi all,
We are generating quotes from Salesforce using Visualforce and rendering the page as PDF.
We are trying to display discounts only on line items that have a discount using the following code:
<apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line"> <tr> <td>{!line.PricebookEntry.Product2.ProductCode}</td> <td align="right"><apex:OutputText value="{!ROUND(line.Quantity,0)}"/></td> <td> {!line.Description}</td> <td align="right"><apex:OutputField value="{!line.UnitPrice}"/></td> <td align="right"><apex:OutputField value="{!line.TotalPrice}"/></td> </tr> <apex:outputPanel id="Discounts" rendered="{!IF(AND(ISPICKVAL(Opportunity.Transport_Charges__c, "Producto Level"), line.Discount__c > 0.0), true, false)}"> <tr> <td align="right" colspan="5">Descuento <apex:OutputField value="{!line.Discount__c}"/></td> </tr> </apex:outputPanel> </apex:repeat>
However this is not working properly. I will explain the 2 problems we are facing:
- Rendered condition - The below formula does not work properly. Even though Transport_Charges__c is a PICKLIST fiel, Visualforce throws up an error when saying it is a text field. If we try to change the expression to Opportunity.Transport_Charges__c == "Product Level" it does not work. Any ideas why?
IF(AND(ISPICKVAL(Opportunity.Transport_Charges__c, "Producto Level"), line.Discount__c > 0.0), true, false)
- Conditional line not displaying correctly - For test purposes, until we solve point 1 above, we have used a condition that always evaluates to true. Now we can see the line speciying the discount level, but the line does not print with the same length as the other lines (see image below). This does not seem to make any sense. Any help much appreciated.

the apex:outputPanel in the middle of the html table y breaking it, becuase put a span tag in the middle of the table.
hide or show the <tr> with style="Display:None" or style="Display:"
this way
<tr style="display:{!IF( condition to hide , 'None', '')}">
<td>line content .... etc
</tr>
Kind regards
All Answers
rendered="{!Opportunity.Transport_Charges__c == 'Producto Level' && line.Discount__c > 0.0}"
regarding point 2 i am not able to get your point clearly..
the apex:outputPanel in the middle of the html table y breaking it, becuase put a span tag in the middle of the table.
hide or show the <tr> with style="Display:None" or style="Display:"
this way
<tr style="display:{!IF( condition to hide , 'None', '')}">
<td>line content .... etc
</tr>
Kind regards
Thanks Larsen.
Hi,
Suppose if you want to display the same grouped by Product Family how will you do it? With apex class it is possible. But how it can be done without controller?
Please help.