You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How can i export report result into pdf format (php code) ?

Received Response
edited Nov 27, 2017 9:38AM in Reporting & Analytics for B2C Service 2 comments


I need to create a PDF report of an incident and i need to attach this to incident. 

When I run a analytic custom report from the php script code, the report's result is in array format. There is a rightnow function (such as getDataXML(), getDataHTML()...) that convert this array result into a PDF file?  Or exist a library for create a PDF files in OSC with a documentation?

Thank you in advance!


Oracle Service Cloud May 2017 SP4

Code Snippet

			$status_filter= new RNCPHP\AnalyticsReportSearchFilter;
			$status_filter->Name = 'Project Reference Number';
			$status_filter->Values = array( $incident->ReferenceNumber );
			$filters = new RNCPHP\AnalyticsReportSearchFilterArray;
			$filters[] = $status_filter;
			$ar= RNCPHP\AnalyticsReport::fetch( $report_id);
			$arr= $ar->run( 0, $filters );
			for ( $i =$arr->count(); $i-- ;)
				$row = $arr->next();
				$obj_array[] = $row;
			//$obj_array contain the result of report
			//HERE : The function for export result into PDF format 
			$fattach = new RNCPHP\FileAttachmentIncident();
			$fattach->ContentType = "text/plain";
			$file_content = //the content of ProjectReport.pdf.
			$fp = $fattach->makeFile();
			$fattach->FileName = $fileName;
			$fattach->Name =$fileName;
			$incident->FileAttachments[] = $fattach;

Howdy, Stranger!

Log In

To view full details, sign in.


Don't have an account? Click here to get started!