KevinMortimer

fpdf php library. Trying to display a table of found records.

Discussion created by KevinMortimer on Feb 5, 2016
Latest reply on Feb 9, 2016 by KevinMortimer

Hi

 

I have been struggling for a few days now to figure out how to show a found set of records using the fpdf php library. The tutorial shows how to create a table but i am just unable to convert it so it works with a Filemaker found set. The example code that works great is attached

 

Here is my code snippet which produces no error but also no results for the foreach looping function. I know that there are records as i have used the getFoundSetCount()  and 10 records were found. SO i am trying to put my $data variable into the "function FancyTable($header, $data)". I would be great full if someone could point out where i am going wrong. The fpdf library is attached. Many thanks

 

$findRequest = $fm->newFindCommand('Discharges: Inpatient list');
$findRequest->addFindCriterion('id_Hospital', "==".$idHospital );

$findRequest->addFindCriterion('dateDischarge', "=" );

$result = $findRequest->execute();

 

  if (FileMaker::isError($result) ) {

$error = $result->getMessage();
$pdf->WriteHTML('Unable to find Discharge records. ERROR: '.$error);
}
else{

    $records = $result->getRecords();

    $foundCount = $result->getFoundSetCount() ;

    $fields = $result->getFields();

    $header = array('Country', 'Capital', 'Area (sq km)', 'Pop. (thousands)');

 

    foreach($records as $record)

        $data = $record->getField("ward");

  }

 

    $pdf->SetFontSize(9);

$pdf->SetY(40 ) ;

$pdf->function FancyTable($header, $data)

Attachments

Outcomes