You need to sign in to do that
Don't have an account?
BobP
Visualforce Repeat View Account related records and the related records child records
I have an interesting problem that i cant seemed to figure out.
I am trying to create a visualforce page pdf with one or apex:repeat components.
I wuold like to create a pdf from the account object that displays related records to the account object and also child record information that is associated to the related record of the account.
I tried creating the following code but i am getting an error.
Error: Unknown property 'VisualforceArrayList.Bid_Deliverables__r'
the first Apex:Repeat gets the related records to the account, the second should return the related records to the related object to the account. I'm not sure if this can be done. Any help would be greatly appreciated.
I am trying to create a visualforce page pdf with one or apex:repeat components.
I wuold like to create a pdf from the account object that displays related records to the account object and also child record information that is associated to the related record of the account.
I tried creating the following code but i am getting an error.
Error: Unknown property 'VisualforceArrayList.Bid_Deliverables__r'
the first Apex:Repeat gets the related records to the account, the second should return the related records to the related object to the account. I'm not sure if this can be done. Any help would be greatly appreciated.
<apex:page standardcontroller="Account" renderas="pdf" standardstylesheets="false" showheader="false" applyhtmltag="false"> <form > <html xmlns="http://www.w3.org/1999/xhtml"> <body> </body> <table align="center" width="85%" style="font-family: Arial, Helvetica, sans-serif; border-collapse: collapse; text-align:center;" cellpadding="2"> <apex:repeat var="sd" value="{!Account.Bids_Sent4__r}"> <tr> <td style="border-bottom:solid;border-bottom-color:#000000;border-bottom-width:1px;" class="ctr"> {!sd.Name}</td> <td style="border-bottom:solid;border-bottom-color:#000000;border-bottom-width:1px;" class="ctr">${!sd.Site__r.Name}</td></tr> <apex:repeat var="et" value="{!Account.Bids_Sent4__r.Bid_Deliverables__r}" > <tr> <td style="border-bottom:solid;border-bottom-color:#000000;border-bottom-width:1px;" class="ctr"> {!et.Scope__c} {!et.Increment__c}</td> <td style="border-bottom:solid;border-bottom-color:#000000;border-bottom-width:1px;" class="ctr">${!et.Price__c}</td> <td style="border-bottom:solid;border-bottom-color:#000000;border-bottom-width:1px;" class="ctr">${!et.Bid_Name__r.Name}</td> </tr> </apex:repeat> </apex:repeat> </table></html> </form> </apex:page>
Once I created a button on the Account object and tested it, the codes works. The finish code is working.
All Answers
Hi @Bobp,
We need to use an extension class to query those records and use them in the visual force page. You can use below extension class.
Now use the bidsList & bidsMap in your visual force page to display the values. Please do add null checks to the above controller. Let me know if this helps.
I am getting a error "Error: Compile Error: Unexpected token '<'. at line 3 column 14"
I used notepad to write the code and did not check for compilation errors. Please use the above code now. If it solves the issue please mark this best answer. Thanks.
I fixed a couple of syntax errors, but i am getting the following error.
"Error: Compile Error: Invalid type: Bids_Sent4__c at line 2 column 31"
I'm getting a error on line 6 too
Error: Compile Error: Method does not exist or incorrect signature: void getRecordId() from the type ApexPages.StandardController at line 6 column 70
Error: Compile Error:
SELECT Id, Bid_Name__c,Bids_Sent__c FROM Site_Bid_Details__c
^
ERROR at Row:1:Column:24
No such column 'Bids_Sent__c' on entity 'Site_Bid_Details__c'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names. at line 15 column 34
Thank you so much for your help
I have fixed the class and was able to save it. Now I just need to add it to my visualforce page. Do you know how I would add the class to the repeat components on the vf page?
Please use the above update code. if you get any error regarding the field not present or field missing error, Please update code to reflect the correct names.
If it works please mark this as best answer.
I've tried to update the visualforce page in the bidsmap repeat section, but no matter what i tried I a am getting the following error.
"Visualforce Error
Help for this Page
Map key a0Mf4000009Yd63EAC not found in map
Error is in expression '{!bidsMap[sd.Id]}' in component <apex:repeat> in page test_awarded"
Once I created a button on the Account object and tested it, the codes works. The finish code is working.