0

I have created a VF email template with a HTML table. In table i have used apex:repeat to trace all child records. But i am not able to get serial number in first column of table.

Using solution provided by Tushar Sharma is showing serial number in PDF attachement but not in email table.

   <apex:repeat var="EW" value="{!relatedTo.Event_Workers__r}">
          <tr>
            <td></td>
            <td>{!EW.Opportunity__r.Name}</td>
            <td>{!EW.Hours_Worked__c}</td>
            <td>{!EW.Base_Pay__c}</td> 
            <td>{!EW.Overtime_Hours__c}</td>
            <td>{!EW.OT_Pay__c}</td>
            <td>{!EW.Service_Charge_Commision__c}</td>               
            <td>{!EW.C_Card_Tipes__c}</td> 
            <td>{!EW.Cash_Tips__c}</td> 
            <td>{!EW.Service_Charge_Tips__c}</td>                                
          </tr>
    </apex:repeat>

1 Answer 1

2

For this you need apex:variable in Your table. Using that you can make your own count variable

<apex:variable value="{!1}" var="count" />
 <apex:repeat var="EW" value="{!relatedTo.Event_Workers__r}">
          <tr>
            <td>{!count}
                <apex:variable value="{!count+1}" var="count" /> 
            </td>
3
  • Actually its showing index properly in PDF file that i have generated of this table. But in table its still showing blank. Commented Feb 15, 2018 at 9:58
  • @Dnyaneshwar because you need to add the same logic in <apex:repeat var="EW" value="{!relatedTo.Event_Workers__r}"> in this repeat as well. Also it will be better if you post a new question instead of editing old question and add new points. Commented Feb 15, 2018 at 10:13
  • 1
    I am really sorry....I went on asking spree instead of investigating first...It was silly question.. Commented Feb 15, 2018 at 10:21

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.