You need to sign in to do that
Don't have an account?
Label template from Contact list iteration
<apex:page renderAs="pdf" standardController="Issue_Year__c"> <table border="0" width="50%" style="page-break-after:always; float:left;"> <apex:repeat var="items" first="0" rows="7" value="{!Issue_Year__c.Items__r}"> <tr> <td>{!items.Opportunity__r.Contact_Delegate__r.FirstName} {!items.Opportunity__r.Contact_Delegate__r.LastName} <br></br>{!items.Opportunity__r.Contact_Delegate__r.Account.Name}</td> </tr> </apex:repeat> </table> <table border="0" width="50%" style="page-break-after:always; float:right;"> <apex:repeat var="items" first="7" rows="7" value="{!Issue_Year__c.Items__r}"> <tr> <td>{!items.Opportunity__r.Contact_Delegate__r.FirstName} {!items.Opportunity__r.Contact_Delegate__r.LastName} <br></br>{!items.Opportunity__r.Contact_Delegate__r.Account.Name}</td> </tr> </apex:repeat> </table> </apex:page>
Above is my code so far for creating a label template from a Contact list. The style info is not included above, however, labels need to be sized properly, aligned properly, in seven rows per page (i.e. followed by a page break) and two columns. This is because they need to print on to label sticker templates.
The difficulty is getting the records to display correctly AND iterate fully over a list that will change in length.
So far, I can get the first page to display correctly. But then I get stuck going into the next page - the list stops after 14 results because of the repeat limits.
I could perhaps use some kind of loop, so something along the lines of:
n=(n + 7)
<apex:repeat var="items" first="n" rows="7" value="{!Issue_Year__c.Items__r}">
But I have not found much help on the boards or the Guide.
Hope someone can help.
Thanks.
Assuming you can use a custom controller, you could partition up the data server side.
Something like:
Page:
Thanks.
That code is a little beyond me, but I was willing to give it a go.
Until I found out that because we have Enterprise, we can create Apex classes.
Unless I still haven't got the hang of this, that means this won't work.
Thanks again though!
You can create apex in enterprise edition, but not in professional edition. If you have the latter then this won't be an option I'm afraid.
Really?
Strange - I looked this up in the SF help pages:
"You can add, edit, or delete Apex using the Salesforce user interface only in a Developer Edition organization, a Salesforce Enterprise Edition trial organization, or sandbox organization. In a Salesforce production organization, you can only make changes to Apex by using the Metadata API deploy call, the Force.com IDE, or the Force.com Migration Tool."
So I can only create Apex in our Sandbox or edit it using one of these tools.
Unless I read that wrong?
I don't have the "New" button either.
Ah, sorry. I was referring to the editions that actually allow salesforce apex authoring in any way.
If you have professional edition, you can't have custom controllers full stop.
If you have enterprise edition, you can have custom controllers, but you can't author code in production. You'd have to develop in a sandbox/production edition and then deploy that to production via Force.com IDE, change set.