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
BdoggBdogg 

How to hide certain data.

Hi I am creating an email template with visual force.  When using the Apex:repeat is there any way to have it not display a value?

 

Here is what I have and it is showing everything related to that object.  However if the ECS__Product__r.Name = "Shipping" I want it to skip that line and not display it.

 

<apex:repeat value="{!relatedto.ECS__Order_Lines__r}" var="ol">
<tr>
<td>
  {!ol.ECS__Product__r.Name}<br/>
</td>
<td>
{!ol.ECS__Quantity__c}
</td>
<td>{!ol.body_end__c}</td>
<td>{!ol.Shaft_End__c}</td>

</tr>
 </apex:repeat>

 

Any thoughts?

 

Thanks!

SFFSFF

Try the rendered attribute on the <apex:outputText> tag. Something like rendered="{!ol.Name != "Shipping" ...

 

Although you can put plain merge fields into your html as you have done here, I would strongly recommend that you use <apex:outputText> tags instead, in part because you can actually use the other attributes like rendered.

 

Hope this helps,

BdoggBdogg

Thanks for the suggestion.  I am very nw to this, can you give me an example as to how it should appear in the template?

 

Thanks!

kiranmutturukiranmutturu

<apex:repeat value="{!relatedto.ECS__Order_Lines__r}" var="ol">
<tr>
<td>
<apex:outputtext value="{!ol.ECS__Product__r.Name}" rendered="{!ol.ECS__Product__r.Name} != 'Shipping'"/><br/>
</td>
<td>
{!ol.ECS__Quantity__c}
</td>
<td>{!ol.body_end__c}</td>
<td>{!ol.Shaft_End__c}</td>

</tr>
</apex:repeat>

BdoggBdogg

kiran_mutturu wrote:

<apex:repeat value="{!relatedto.ECS__Order_Lines__r}" var="ol">
<tr>
<td>
<apex:outputtext value="{!ol.ECS__Product__r.Name}" rendered="{!ol.ECS__Product__r.Name} != 'Shipping'"/><br/>
</td>
<td>
{!ol.ECS__Quantity__c}
</td>
<td>{!ol.body_end__c}</td>
<td>{!ol.Shaft_End__c}</td>

</tr>
</apex:repeat>


Thanks kiran_mutturu,

Unfortunatly that didn't work.  Changing the current code for to what you provided there is no output for that field. Please see the images attached.  ImageA does not have the "Render" information.  ImageB does have it.  Any recommendations?

Image A:

 

Image B (With <apex:outputtext value="{!ol.ECS__Product__r.Name}" rendered="{!ol.ECS__Product__r.Name} != 'Shipping'"/>)

Thanks!

 

sravan alaparthisravan alaparthi

Dear Bdogg,

 

The best way i woud suggest for this would be using a custom controller.

 

Tips:

 

1)Make a list querying for the record id's you dont want to display

2)Only get the records you want to display in another list by using the query

      SELECT xxxxxxxxxxx FROM SObject__c WHERE ID NOT IN List1

 

So using repeat on list 2 will generate only required data

 

Sravan Alaparthi

Salesforce Developer/Admin/Consultant/Configurator