I am trying to add a company logo for all reports. Is there an efficient way to do so? or do I have to add the logo for each report manually?
CompanyInfo companyInfo = CompanyInfo::find();
This code will reflect current company logo
This could be display method in temp table which renders data on report.
you need to add it to each needed report, there is no way to add it globally somewhere to make it applicable everywhere.
To display company logo on report, follow the below steps:
1) Add a container type field on report temp table, e.g CompanyLogo.
2) Use the code as Mohammad suggested, and assign the temp table field that value as shown below:
TempTableBuffer.CompanyLogo = CompanyImage::findByRecord(companyInfo).Image;
3) Open report in VS, refresh report dataset.
4) Add Image control on the report design where you want the image to be displayed and use the field Companylogo on that control like Fields!CompanyLogo.
Please verify and let me know if you have further queries.
Also you can use FormLetter::CompanyInfo(), it's the same.
Suggest you to create a new temp table and populate it in a static method of reusable class.Since you have to do it for every report, dont need to add the container field on every report temp table and go about it.
Just get the Dp class to call this static method, add another method to retrieve this new temp table.
Code can be reused this way and only one record insertion with container field helps in performance than getting each and every record populated with container field.
you have to update each and every report with new dataset using the same Dp class
Hi You can either use
you can add an image under Resources node of AOT and than access this into your code.
TO know how to use resources, follow below link
as suggested Mohammad Raziq, using this code CompanyInfo companyInfo = CompanyInfo::find(); CompanyImage::findByRecord(companyInfo).Image; you can add it to a tmp table used by RDP class and then add it to your report according you needs. The logo is global and it is in one place. Something useful when it comes to branding. :)